Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Set Date Value in a Variable VBScrpit

How to turn this command in vbscript?

let vDate = Date(Now(), 'YYMMDD');

Labels (1)
11 Replies
Not applicable
Author

does anyone know? I need to finish the script today: (

Not applicable
Author

try with something like this:

sub X

   v = ActiveDocument.Evaluate("=date(today(),'DD/MM/YYYY')")

   ActiveDocument.Variables("vDate").SetContent v, true

end sub

then add action external to execute macro X

Hope this help you

Not applicable
Author

this line.....

ActiveDocument.Variables("vDate").SetContent v, true

has some error is not working ...

Miguel_Angel_Baeyens
Support
Support

Hi,

Did you create the variable in the document? Settings menu, Variable Overview.

Regards,

Miguel

Not applicable
Author

like this

v = today()

Miguel_Angel_Baeyens
Support
Support

Hi,

ActiveDocument.Variables("vDate")

Refers to an actual variable that has to be created before getting a value. Go to the Settings menu, Variable Overview and Add a new one and call it vDate. Then the macro will work.

Regards,

Miguel

Not applicable
Author

it worked ....


How do I get the value of this variable and saved a excel document?

i try this

XLDoc.SaveAs "c:\Qlikview\Claro"&vDate&".xls"

Not applicable
Author

You have to get the variable value, so use:

XLDoc.SaveAs "c:\Qlikview\Claro"& ActiveDocument.Variables("vDate").GetContent.String &".xls"

Regards

Not applicable
Author

Excel displays an error .... like this


Excel can not access the file 'C: \ QlikView \ Claro03 \ 12 \ D5680000'. There are several possible reasons