Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

moving focus from Excel to Access 2

Status
Not open for further replies.

kndavies

Technical User
Jan 23, 2003
30
GB
Hi,

No doubt this is simple but I haven't managed it yet :(

Using Office 2000:

I have an application that
1) Opens a browse window for the user to select an XLS spreadsheet
2) Opens the spreadsheet and cleans some data
3) Saves and closes the spreadsheet
4) Imports the spreadsheet to an existing table
5) Opens a new browse window to repeat this operation on a second spreadsheet.

My problem is that the focus stays with the Excel window and the user cannot see the new browse window to select the second spreadsheet.

I do not want to close Excel as the user may have other spreadsheets open.

All suggestions most welcome!

Thanks in advance for your help
Ken.
 
Dim exApp As object
Set exApp = CreateObject("Excel.Application")
exApp.Workbooks.Open FileSpec


exApp.Workbooks.Close

This will close only those workbooks opened using this Excel Object. Those opened outside the application as well as those opened using a separate Excel object will remain open.
Using exapp..GetOpenFilename should be OK after that

Best of luck
 
thanks both of you.
minimising the window then clearing the variable worked just fine.
MinusM's solution is well worth noting as most of my customers need reports exported to Excel for manipulation so I shall undoubtably use it.

Regards,
Ken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top