Hello All,
I have a vba macro which I need to trigger using VB script and it is working so far good, but only road block is it is not saving the thisworkbook with the changes.
I have some data which will be saved in the different sheets of thisworkbook and this works fine when run manually but when I try to run through vb script it does not save.
Below is the vb script i'm using
Option Explicit
On Error Resume Next
ExcelMacroExample
Sub ExcelMacroExample()
Dim xlApp
Dim xlBook
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Open("MyPath", 0, True)
xlApp.Run "Macroname"
xlApp.Application.Save
xlApp.Application.Quit
Set xlApp = Nothing
End Sub
Below code which I'm using in my module to save the workbook
ThisWorkbook.Save
ThisWorkbook.Close True
Any help would be appreciated!!!
Bookmarks