I'm trying to do 'Refresh All' (as shown in the image below) using a Macro:
Following is the macro (which is written in Module1):
Sub Workbook_RefreshAll()
ActiveWorkbook.RefreshAll
End Sub
And then I'm writing a VBScript as follows:
'Code should be placed in a .vbs file
Set objExcel = CreateObject("Excel.Application")
Set book = objExcel.Workbooks.Open("excel.xlsm", , True)
WScript.Echo "Executing RefreshAll"
objExcel.Application.Run "'excel.xlsm'!Module1.Workbook_RefreshAll"
WScript.Echo "Executing Mailing"
objExcel.Application.Run "'excel.xlsm'!ThisWorkbook.Mail"
objExcel.DisplayAlerts = False
objExcel.Application.Quit
Set objExcel = Nothing
But it is not refreshing the workbook.