OLE Action issue when using Excel VBA to run Access Macro

Bullpen

New Member
Joined
Jul 19, 2011
Messages
48
Hey everyone,

I have written an Excel VBA that runs an Access Macro. The problem is that I receive the error message 'Microsoft Excel is waiting for an OLE action to complete' over and over.

The Access macro results in a large file and takes about 1 minute when I run it by itself (manually, not through Excel macro). The Access Macro was made to output the data into a new spreadsheet and I cannot change the Access macro.

I included the lines 'Application.DisplayAlerts = False' and 'Application.DisplayAlerts = True' because I saw someone recommend that on this site.

Here is my Excel VBA Code

Sub Run_Access_Macro()
Dim A As Object
Set A = CreateObject("Access.Application")
A.OpenCurrentDatabase ("C:\Users\john\desktop\SFWH.accdb")
A.DoCmd.RunMacro "mT-MobileProject"
Application.DisplayAlerts = False
A.CloseCurrentDatabase
A.Quit
Application.DisplayAlerts = True
Set A = Nothing
End Sub


Any help is greatly appreciated!!

Thank you

John
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
I am not sure but I wonder if Excel is not waiting for the Access macro to finish.
You could try adding a wait after the RunMacro:
Code:
Application.Wait Now() + TimeValue("00:01:00")
Example given is for one minute.
 
Upvote 0
Thank you Derek Brown for responding to my question. Unfortunately it did not help. I think the problem is with the Access macro. The Access macro is programmed to automatically export the data into a new spreadsheet and it seems to have an issue with the fact that Excel is already open or that the Access macro is being initiated by Excel.

John
 
Upvote 0
I have a similar issue. My Excel macro runs Access to export a file and get the OLE error. Has anyone come up with a solution to suppress te OLE error message? If I click on it when the Access macro is complete then the Excel macro carries on like normal but I'd like to have no prompts during the process so I can leave it running without any action.
 
Upvote 0
You could try:
Code:
Application.DisplayAlerts = False
.
.
.
Application.DisplayAlerts = True
but if your code is not waiting for the Access process to complete, could that result in a later error?
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,909
Members
452,949
Latest member
beartooth91

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