Activate open Excel sheet from Access VBA

koltregaskes

New Member
Joined
Feb 8, 2005
Messages
15
I have a macro that needs to go back and forth between an Excel macro. I have the script to open the Excel workbook and activate the sheet I'll be using then thereafter it needs to go back and forth to update dates and times.

I have the following code that opens the workbook each time to update these dates and times but is there a way to simply switch to the workbook instead and thus speeding up the process?:

Code:
Dim xl As Object
Set xl = CreateObject("Excel.Application")
xl.Workbooks.Open ("\\drive\folder\workbook.xlsm")
xl.Visible = False
xl.Run "macro"
xl.ActiveWorkbook.Close (False)
xl.Quit
Set xl = Nothing
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
What do you mean , 'back and forth'? Between Excel and Access?

To do what? copy data from Access to Excel? if so use transferspreadsheet OR copyfromrecordset.
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top