2016 Aug 16 4:40 AM
Hi experts.
I 'm using class document_proxy for export some table to Excel.
But I can't execute macro using method document_proxy->execute_macro( ).
Text macro is:
Sub test ()
Range("A5:E28").select
End Sub
The message is: TYPE MISMATCH: 'Range'.
Maybe somebody faced such problem and can help me to solve it?
2016 Aug 19 5:06 AM
I 've got one more question. We have implemented the editor for entering Vbscript text and we need syntax check entering text. It is possible to implement it in SAP.
2016 Aug 16 9:00 AM
did you try:
set x = excel.activeworkbook
x.range("A5:E28").select
2016 Aug 16 9:02 AM
did you separate macro lines with CR_LF ?
did you try with the simplest call : msgbox("hello world") ?
2016 Aug 16 10:50 AM
Hello, Rossi.
Thanks for help. Yes I separate micro lines with CR_LF.
I will try first variant and I got an error 'Object required: excel'.
2016 Aug 16 3:21 PM
did you try with the simplest call : msgbox("hello world") ?
2016 Aug 17 2:21 AM
Simplest call msgbox("hello world") is work. But if I use excel objects such as Excel, Worksheet, Range the execute_macro( ) do not understand it.
2016 Aug 17 2:19 PM
I did a test, and we need to add Set excel = GetObject(,"Excel.Application"), then excel.range("A5:E28").select should work
2016 Aug 18 5:26 AM
Thanks very much, it is work.
But I thought that execute_marco( ) execute VBA macro, but it turns out that is VBscript macro.
2016 Aug 18 7:17 AM
2016 Aug 18 8:07 AM
2016 Aug 19 5:06 AM
I 've got one more question. We have implemented the editor for entering Vbscript text and we need syntax check entering text. It is possible to implement it in SAP.
2016 Aug 19 2:46 PM
No idea (maybe write it to a local .vbs file, and call cl_gui_frontend_services=>execute). I always do it that way: first, record the VBA macro (manual actions recorded automatically), adjust it to make it work according to your requirements, then copy it to a VBS file run it and edit it until it works (there are few rules to know to convert a VBA into a VBS).
2016 Aug 22 3:32 AM
2016 Aug 25 5:44 AM
In continuation of the issue.
When we use execute_macro, we write in marco text such as ws.Range("A3").Value = "Сережа", that is we want write Russian text in cell, but when the macro runs in Excel cell we see abracadabra(jubberwocky). It seems what problem with encoding, but we could not find parameter Encoding in execute marco or in add_marco.
Maybe somebody knows where we can specify the encoding?