473,382 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How to give Excel workbook focus

JM
Hi
I was wondering if anyone out there knew how to give a Excel workbook focus.
Problem is that if I go away and do work on something else e.g. E-Mail while
the C# program is dropping data into Excel that it will miss data.

How do I give the Excel workbook focus so that it will drop the data in and
not go into limbo land? A web address or a snippet of code would be helpful.

Thanks
Nov 17 '05 #1
1 2256
I know that this can be achieved using the SetForegroundWindow API passing
the window handle. This API can be called from within C# but I don't know if
there is an 'easier' way using .NET base classes

http://msdn.microsoft.com/library/de...oundwindow.asp

Gabriel Lozano-Morán

"JM" <JM@discussions.microsoft.com> wrote in message
news:F1**********************************@microsof t.com...
Hi
I was wondering if anyone out there knew how to give a Excel workbook
focus.
Problem is that if I go away and do work on something else e.g. E-Mail
while
the C# program is dropping data into Excel that it will miss data.

How do I give the Excel workbook focus so that it will drop the data in
and
not go into limbo land? A web address or a snippet of code would be
helpful.

Thanks

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Geert-Pieter Hof | last post by:
Hello, My VB 6.0 application read and writes data from and to a MS Excel workbook, using the Microsoft.Jet.OLEDB.4.0 provider. Now I want to protect the Excel workbook with a password, but I...
2
by: Belinda | last post by:
Hello All I want to place a Excel workbook on the web server and create a URL link to it and when the user clicks on it to the URL/vbscript behind it must launch Excel on the client and open the...
2
by: WZ | last post by:
I used the following code to create a workbook and save it in a webapplication. dim oExcel As Excel.ApplicationClass dim oBook As Excel.WorkbookClass dim obooks As Excel.Workbooks dim designb...
7
by: Pierre | last post by:
Hi, Tryin to use this method : MyExcelObject.Application.ActiveWorkBook.set_Colors(int index, object RHS). But really don't know what this RHS is ? Any ideas ? Thks for help
1
by: javzxp | last post by:
Hi I'd like to use C# to open an existing Excel workbook and save each worksheet it contains into a new Excel file. The name of each new Excel file should be the name of the worksheet copied...
1
by: Jerry J | last post by:
I am sending Excel reports to web clients. Excel opens in internet explorer displaying multiple sheets. It is pretty simple to do and works well. To do it, a client clicks a link to an ASPX page...
1
by: Mark | last post by:
Hello - I'm opening/saving an Excel workbook from ASP.Net. When I try to save the workbook I get the error: System.Runtime.InteropServices.COMException: The remote procedure call failed. ...
10
by: John Brock | last post by:
My VB.NET program pops up an Excel workbook for the user. If I initially create the workbook using: Workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet) I end up with a...
3
by: lmefford | last post by:
Alright, I've got a bit of a dilemma so I figured I would actually ask for some help. My girlfriend and I have been working on a program that she got commissioned to do for her brother and the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.