YasserKhalil
Well-Known Member
Hello forum members
I am trying to run this vbs file
and this is the macro inside the vbe
It works well but doesn't save the changes .. It would save the value in A1
Any ideas?
I am trying to run this vbs file
Code:
Dim xl
Dim xlBook
Dim sCurPath
path = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
Set xl = CreateObject("Excel.application")
Set xlBook = xl.Workbooks.Open(path & "\Run Macro From Outside Excel.xlsm", 0, True)
xl.Application.Visible = False
xl.DisplayAlerts = False
xl.Application.run "Test"
xlBook.Save
xl.ActiveWindow.Close
xl.Quit
Set xlBook = Nothing
Set xl = Nothing
and this is the macro inside the vbe
Code:
Sub Test()
Sheets("Sheet1").Range("A1").Value = Now()
MsgBox "Hello Everyone"
End Sub
It works well but doesn't save the changes .. It would save the value in A1
Any ideas?