i using add-in streamline creation of report raw data available in spreadsheet. raw data usded available .xlsx file, it's available in .csv.
as part of tracking data comes use following code access creation date of spreadsheet.
dim reportbook workbook dim databook workbook set reportbook = workbooks("report.xlsx") set databook = workbooks("data.csv") reportbook.worksheets("admin") .cells(1, 1) = format(databook.builtindocumentproperties("creation date"), "dd/mm/yyyy hh:mm") end
i have checked both reportbook
, databook
correctly referring intended files.
when tried use .csv file databook
got both automation error , unspecified error. can see being related fact databook .csv rather .xlsx. ideas why?
it's failing because csv file doesn't contain same meta data proper excel workbook. try using filesystemobject part of scripting library instead:
edit:
a version of code outlined in link:
sub test() msgbox creationdate(workbooks("data.csv").fullname) end sub public function creationdate(fullpath string) date creationdate = createobject("scripting.filesystemobject").getfile(fullpath).datecreated end function
Comments
Post a Comment