Dominik
Dominik

Reputation: 31

Excel VBA Call Shell with quotes in string

I don't really know how to deal with my problem. So what i want is:

Call Shell("C:\Temp\Zint\zint.exe -d "1234"",vbNormalFocus)

I use this command in the windows command line: C:\Temp\Zint\zint.exe -d "1234"

It works only when the numbers are given between quotes.

I was unable to deal with the quotes, so please be so kinde to explain me how should i use them.

Thanks!

Upvotes: 3

Views: 3530

Answers (2)

Dominik
Dominik

Reputation: 31

The solution is:

Call Shell("C:\Temp\Zint\zint.exe" & " " & "-d" & Chr(34) & "1234" & Chr(34), vbNormalFocus)

Upvotes: 0

Tim Williams
Tim Williams

Reputation: 166980

In VBA quotes are escaped by doubling them up:

Call Shell("C:\Temp\Zint\zint.exe -d ""1234""",vbNormalFocus)

Upvotes: 5

Related Questions