0

I'm trying to run a vbscript file from excel macro, can anyone please help.

Dim sFilename As String
sFilename = ActiveWorkbook.Path & "C:\Users\266720\AppData\Roaming\SAP\SAP GUI\Scripts\Script7-pa30.vbs"
sFilename.Run
2
  • 1
    Possible duplicate of Calling a .vbs script from Excel VBA Commented May 11, 2016 at 12:55
  • 1
    Currently, sFilename will look like c:\foo\bar\c:\Users\266... You are concatening two absolute paths Commented May 11, 2016 at 13:14

1 Answer 1

-1

Could be an issue with the space in your reference.

"C:\Users\266720\AppData\Roaming\SAP\SAP GUI\Scripts\Script7-pa30.vbs"

I would change the folder name to SAP_GUI and see how that works, or use double quotes around the whole line.

"""C:\Users\266720\AppData\Roaming\SAP\SAP GUI" & "\Scripts\Script7-pa30.vbs"""
Sign up to request clarification or add additional context in comments.

1 Comment

Windows manage spaces in paths. And this is not sent to a shell so a space should not matter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.