We are celebrating the 10-year anniversary of the Alteryx Community! Learn more and join in on the fun here.
Start Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Run tool Excel OLE action error

vj28
8 - Asteroid

I have a workflow that deals with an excel file with formulas, which need to refresh first before I can continue working on said file in alteryx, so i use a vba script that opens, saves and closes a specific excel file as part of the workflow.

 

But anytime alteryx gets to that part of the workflow I get the error : 

 

"Microsoft excel is waiting for another application to complete an OLE action"

 

I keep getting this dialogue when the alteryx is executing the workflow and gets to the run tool. 

 

This is the code for the macro :

 

Sub macro1()
Dim objExcel
Dim objworkbook

':: Open and edit an Excel File.
'---------------------------------


'create the excel object
Set objExcel = CreateObject("Excel.Application")
objExcel.Application.DisplayAlerts = False
'view the excel program and file, set to false to hide the whole process
objExcel.Visible = False

'open an excel file (make sure to change the location) .xls for 2003 or earlier
Set objworkbook = objExcel.Workbooks.Open("C:\Users\user_name\Downloads\sandbox_demo\trial.yxmd")

'close the workbook
objExcel.Calculation = xlCalculationAutomatic
objworkbook.RefreshAll
objworkbook.Save
objworkbook.Close True
Set objworkbook = Nothing
'Wscript.Echo "Ran successfully"
objExcel.DisplayAlerts = True
objExcel.Quit


'release objects

Set objExcel = Nothing
End Sub

 

run tool configs :

command : wscript

 

command arguments: 

.\refresh_formulas.vbs

 

2 REPLIES 2
Raj
16 - Nebula

@vj28 
RefreshAll can be asynchronous, meaning the script might proceed to the next step before Excel finishes refreshing. To ensure the refresh is completed, use the CalculateUntilAsyncQueriesDone method and add a delay.

Hope this helps.

vj28
8 - Asteroid

@Raj  I'm currently unfamiliar with vba syntax; looked up the documentation but I still get a synatx error. Could you tell me exactly the line of code I'd need to insert here? 

Labels
Top Solution Authors