Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Export with time stamp

Hello all, i have an export which works fine, but now i want to add a timestamp to it

Original:

Sub Send_to_excel

Path = "C:\Export\Export.xls"

set obj = ActiveDocument.GetSheetObject("CH12")

obj.ExportBiff Path

End Sub

New:

Sub Send_to_excel

Path = "C:\Export\Export.xls"&now()&".xls"

set obj = ActiveDocument.GetSheetObject("CH12")

obj.ExportBiff Path

End Sub

But this is not working, can anyone help me out here?

1 Solution

Accepted Solutions
Not applicable
Author

Found it!

Sub Send_to_excel

Path1 = "C:\Users\Kadenza\Projecten\Maxxium\SimulationModel\Export\"

Path2 = "Export_"

vNow = Cstr(Now())

Path3 = Replace(vNow,":","")

Path4 = ".xls"

Path = Path1&Path2&Path3&Path4

set obj = ActiveDocument.GetSheetObject("CH12")

obj.ExportBiff Path

End Sub

View solution in original post

4 Replies
Not applicable
Author

This one is working:

Sub Send_to_excel

Path1 = "C:\Users\Kadenza\Projecten\Maxxium\SimulationModel\Export\"

Path2 = "Export_"

Path3 = Cstr(Date())

Path4 = ".xls"

Path = Path1&Path2&Path3&Path4

set obj = ActiveDocument.GetSheetObject("CH12")

obj.ExportBiff Path

End Sub

But I have only the date and when  do this one it isn't working anymore;

Sub Send_to_excel

Path1 = "C:\Users\Kadenza\Projecten\Maxxium\SimulationModel\Export\"

Path2 = "Export_"

Path3 = Cstr(Now())

Path4 = ".xls"

Path = Path1&Path2&Path3&Path4

set obj = ActiveDocument.GetSheetObject("CH12")

obj.ExportBiff Path

End Sub


kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Instead of now() try today().

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Not applicable
Author

Found it!

Sub Send_to_excel

Path1 = "C:\Users\Kadenza\Projecten\Maxxium\SimulationModel\Export\"

Path2 = "Export_"

vNow = Cstr(Now())

Path3 = Replace(vNow,":","")

Path4 = ".xls"

Path = Path1&Path2&Path3&Path4

set obj = ActiveDocument.GetSheetObject("CH12")

obj.ExportBiff Path

End Sub

Not applicable
Author

Today is not a function in VB script