can anyone help me,when i use Excel Marco in invoke VBA,when i test in excel,the marco is running well,but when i used in invoke VBA,get such error.below is the marco code which saved txt file
and I’m sure that this invoke vba is kept within a excel application scope
Hi @ting801215 ,
Could you try renaming the file to kkk.vbs and trying again?
Also, if you run into an error once more, kindly share them here as well.
Useful Tip:You can press Ctrl+Shift+S and take a snippet of the screen you wish to capture
-Ashwin A.K
Thanks for your fast reply,I will try it again as your advice,and share you the result to u then.
after try again,unfortunately,aslo doesn’t work,can you help me again
Hi @ting801215 ,
Sorry, it had nothing to do with the file extension.
I think it has something to do with the way you have declared your VBA code.
Try using
Public Function
…
End Function
Also, if your excel already contains VBA code, then why not use the Excecute Macro Activity ?
Here is a sample of the code if you are using a normal Excel File:
InvokeVBA Example.zip (14.7 KB)
-Ashwin A.K
Sorry for reply late ,I just tested the Excecute Macro Activity ,definitely work normal,but if I tried use invoke VBA,still get the same error as snapshot, I deleted the macro in excel after saved the macro as kkkk.vbs.
Adrian_Star
(Adrian Starukiewicz)
April 6, 2021, 7:06am
7
Hi,
if you invoking macro from “Invoke VBA” save your macro in .txt file eg. my_macro.txt
Inside file use pattern:
Sub MacroExcel()
'your Macro
End Sub
Like here:
and refer to “MacroExcel” .
Do not add any content before the SUB. It works for me in this confuguration.
Thanks so much ,problem was solved according your advice ,modified the Macro code as below
Sub Macro13()
’
Range(“C2”).Select
ActiveCell.FormulaR1C1 = “=RC[1]*1”
Range(“D2”).Select
ActiveCell.FormulaR1C1 = “=订单列表!RC[3]”
Range(“C2:D2”).Select
Selection.AutoFill Destination:=Range(“C2:D1100”)
Range(“C2:D1100”).Select
End Sub
thanks again~
1 Like
system
(system)
Closed
April 9, 2021, 7:44am
9
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.