Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
This seems like it should be SOOO SIMPLE but I'm pulling my hair out :
I have table that the user will choose to save using a button.
In my vbscript for the button, I am trying to modify the path and name where the ServerSideExportEx saves the file.
This works:
tb.ServerSideExportEx "D:\QlikView_documents\Developpement\1-Sources\XML\Provisions.xml" , ";" , 3 '0=HTML, 1=Text, 2=Bitmap, 3=XML, 4=QVD, 5=BIFF
But I'd like to pass the path and the file name as variables.
The file name will be "Provisions_" & [year - month selected].
My file path and the year-month selected are both variables in the qwd, so I tried this :
set dateProvisions = ActiveDocument.Variables("vDateProvision")
set pathProvisions = ActiveDocument.Variables("vRepSourcesXml")
set fileName = "Provisions_$(vDateProvision).xml"
This bombs.
My next work-around was to create a variable in the qwd that saves the file name as "Provisions_"&$(vDateProvision)&".xml"
I can't get my variable to work correctly either!
In the variables menu, I set the variable to "Provisions_"&$(vDateProvision)&".xml" -- no good.
Then I tried concat("Provisions_",$(vDateProvision),".xml") -- also no good.
Does anyone have any suggestions ?
Thanks!
Strange
I would try:
MsgBox pathProvisions.GetContent.String
MsgBox dateProvisions.GetContent.String
Just to make sure everything is ok.
And then start adding them together one after the other. Using MsgBox
set dateProvisions = ActiveDocument.Variables("vDateProvision")
fileName = "Provisions_" & dateProvisions.GetContent.String &".xml"
Opps, I forgot to mention that I tried that originally.
This is where my vbscript stops.
How does the content of the vDateProvision look like - and how does the content of dataProvisions look like exactly?
I agree with Peter.
Use MsgBox dateProvisions.GetContent.String to look at the value.
In my variables I set vDateProvision to this :
And when I run my script, I get
for info DateProvision is the Date selected.
to be clear, the msgbox is showing the following:
set dateProvisions = ActiveDocument.Variables("vDateProvision")
ActiveDocument.GetApplication.MsgBox( dateProvisions.GetContent.String)
Ok
So then
fileName = "Provisions_" & dateProvisions.GetContent.String &".xml"
Should work
By the way. This is incorrect:.
Set fileName = "Provisions_" & dateProvisions.GetContent.String &".xml"
I just took out the set.
It still doesn't work!
A new idea, can I set the file name directly in the tb.ServerSideExportEx line ?
I just tried this :
tb.ServerSideExportEx pathProvisions & "\" & "Provisions_" & dateProvisions.GetContent.String & ".xml", ";" , 3
But it didn't work...
Is there some way to run a debugger, or to get an error message ?
MsgBox pathProvisions & "\" & "Provisions_" & dateProvisions.GetContent.String & ".xml"
Is unfortunately the only way out..