Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
nickm
Contributor
Contributor

macro: export qvd with date-timestamp and insert 0 value for nulls inputfield

Hello,

I use the below macro to export chart data to qvd and I need to include a date/timestamp so I do not overwrite the prior export.

SUB SaveBudgetQVDLocal

    set obj = ActiveDocument.GetSheetObject("CH5026")

    obj.ExportEx "C:\Users\nicholasm\Desktop\NEW_BUDGET_BUILD_2015_v4\new_budget_R12_analysis_build_2015\Exec_R12_Frcst_Reporting_v3.qvd", 4

   

END SUB

Any info on how to insert 0 for null values in an inputfield specific to a column in a table box via a macro would be greatly appreciated. I have tried many variations... no luck.

Thx and have a great day - Nick M.

1 Solution

Accepted Solutions
marcus_sommer

Try it with a date, maybe with changed or additional formating from them or a timestamp:

SUB SaveBudgetQVDLocal

set obj = ActiveDocument.GetSheetObject("CH5026")

path = "C:\Users\nicholasm\Desktop\NEW_BUDGET_BUILD_2015_v4\new_budget_R12_analysis_build_2015\"

filebase = "Exec_R12_Frcst_Reporting_"

filedate = year(date) & "_" & month(date) & "_" & day(date)

fileext = ".qvd"

exportTyp = 4

obj.ExportEx path & filebase & filedate & fileext, exportTyp

   

END SUB

A counter would be need more efforts. Either saving the counter separatly or reading and checking the folder for each file.

- Marcus

View solution in original post

4 Replies
marcus_sommer

Try it with a date, maybe with changed or additional formating from them or a timestamp:

SUB SaveBudgetQVDLocal

set obj = ActiveDocument.GetSheetObject("CH5026")

path = "C:\Users\nicholasm\Desktop\NEW_BUDGET_BUILD_2015_v4\new_budget_R12_analysis_build_2015\"

filebase = "Exec_R12_Frcst_Reporting_"

filedate = year(date) & "_" & month(date) & "_" & day(date)

fileext = ".qvd"

exportTyp = 4

obj.ExportEx path & filebase & filedate & fileext, exportTyp

   

END SUB

A counter would be need more efforts. Either saving the counter separatly or reading and checking the folder for each file.

- Marcus

nickm
Contributor
Contributor
Author

Marcus,

Thanks for the input I will give it a try.

Thx - Nick

nickm
Contributor
Contributor
Author

Marcus the code you provided exported the file with today's date, how would I add the timestamp?

Thx - Nick

marcus_sommer

Instead of date you could use time or now() and extend the file-name variable to hour(), minute() and/or second() - you could also try to use now () directly as file-name part, the return-format depend from the system-settings and will give me the string with a bad order-feature and invalid path-chars. But in your case it might be other, try it at first.

- Marcus