user406151
user406151

Reputation: 425

Remove single quotes export file name in VBScript

Using VBScript, I'm getting unintentional single quotes for initPeriod in my export file name with the following

initperiod = datepart("YYYY",Date) & strMonth

""Export_File:C:\GrabIt\Test\{Command.idxnum}\{Command.idxnum}_DriverPage_""" & initPeriod & """_YTD.pdf""

Result is 11_DriverPage_'201210'_YTD.pdf

How do I remove the single quotes from initPeriod?

Upvotes: 0

Views: 216

Answers (1)

sj1900
sj1900

Reputation: 412

I'm assuming you want quotes around the entire exportfile line. In that case, it looks like you are missing a quote at each end. I'm also guessing that you probably don't want quotes around the value of initPeriod, where you have used too many. In that case, it should be:

"""Export_File:C:\GrabIt\Test\{Command.idxnum}\{Command.idxnum}_DriverPage_" & initPeriod & "_YTD.pdf"""

Or if you don't want quotes around the whole thing:

"Export_File:C:\GrabIt\Test\{Command.idxnum}\{Command.idxnum}_DriverPage_" & initPeriod & "_YTD.pdf"

Keep in mind that "" inside a string means a quote char will be included in the string. A string set = "" is an empty string.

If that's not it, you'll need to post exactly what outcome you are trying to achieve.

Upvotes: 1

Related Questions