on 08-26-2010 9:37 PM
Hi All - does anybody know the way to pass on a parameter to an Excel macro from within the SAP script? I have this line:
session.findById("wnd[0]/tbar[0]/btn[15]").press
Set xclapp = CreateObject("Excel.Application")
xclapp.ScreenUpdating = False
xclapp.Visible = False
xclapp.DisplayAlerts = False
Set xclwbk = xclapp.Workbooks.Open("S:\Schedules\Excel_Scripts.xls")
xclapp.Run "Excel_Scripts.xls!New_MR_Bklog_No_Op_wp(PrS)"
Set xclwbk = Nothing
xclapp.Quit
set xclapp = Nothing
WScript.Quit
This doesn't work because it thinks the paramaeter is part of the macro name. How would I go about sending the contents of that variable across?
Thanks
Umur
Hi Umur,
it should be like this:
Set xcl = createObject("Excel.Application")
set wbk = xcl.Workbooks.open("C:\Mappe1.xls")
xcl.ScreenUpdating = False
xcl.Visible = True
xcl.DisplayAlerts = False
xcl.Run "Modul1.Main", "Hallo Welt"
wbk.close
set wbk = nothing
xcl.quit
set xcl = Nothing
Testetd under winXP and Ofifce 2003
The Sub Main looks like this
Sub Main (ByVal a_Text as String)
msgbox (a_text)
End Sub
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.