Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
racer25
Creator
Creator

Export to CSV with custom filename

Hi 

I can see plenty of code snippets that will allow me to export a table to a csv by clicking a button and indeed.

Such as; 

Sub ExportToFile

'Download Sheet ojbect data to CSV

set sObject = ActiveDocument.GetSheetObject("TB01")

sObject.Export "C:\TestFile.csv", ", "

End Sub

What I am looking to be able to do is customise the filename to be

Company_BookmarkName_Agency_YY_MM_DD.

Any help would be appreciated on this as I am not overly familiar with macro's ( copy paste and tweak ).

Thanks

Rob

 

 

Labels (2)
2 Replies
Andrea_Spinetti
Former Employee
Former Employee

Hello, thank you for posting in our community! Some of our community members found a solution to your request in this thread. Also, consider using the STORE function as it can be used to store also CSV (not just QVD). 

If the issue is solved please mark the answer with Accept as Solution.
marcus_sommer

You could create a variable for it like:

Sub ExportToFile

'Download Sheet ojbect data to CSV

var = "C:\TestFile" & year(Date()) & "_" & month(Date()) & "_" & day(Date()) & ".csv"

set sObject = ActiveDocument.GetSheetObject("TB01")

sObject.Export var, ", "

End Sub

- Marcus