It seems that you are trying to use Excel from Web server, however this is not a designed usage of Office: https://support.microsoft.com/en-us/topic/considerations-for-server-side-automation-of-office-48bcfe93-8a89-47f1-0bce-017433ad79e2.
exec VBA form VBS not working
kurooon
1
Reputation point
I tried to execute VBA from VBS from PHP.
~ image ~
<PHP> : exec( fileName.vbs) => <VBS> : Obj.Application.Run "CreateTwinYAxisGraph" => <VBA> : CreateTwinYAxisGraph
The function exec() and VBS worked, but VBA was not ...
And I tried to execute VBS on Command line, VBA function succeeded.
I want to know how to work.
Here is my code.
Dim Obj
Dim FilePath
Set Obj = WScript.CreateObject("Excel.Application")
Set ObjArgs = WScript.Arguments
FilePath = ObjArgs(0)
Obj.Visible = True
Obj.Application.DisplayAlerts = False
CreateObject("WScript.Shell").AppActivate Obj.Caption
Set excel = Obj.Workbooks.Open(FilePath)
Obj.Application.Run "CreateTwinYAxisGraph"
excel.Save
excel.Close
Obj.Quit
Set excel = Nothing
Set Obj = Nothing
Microsoft 365 and Office Development Other
4,374 questions
Developer technologies Visual Basic for Applications
1,507 questions