I'm copying out a range of data from a report formatted as an .xlsx into my running report. Along with the data, I want to capture the file "Creation Date" metadata to use as the worksheet name. It's also going into the first blank cell in a column range so using that cell for the worksheet name is, to me anyway, as easy as anything else. I found code posted in 2006 ( http://www.mrexcel.com/forum/excel-...properties-doesnt-return-expected-data-2.html ), and added in what I think is correct to get the data to my running report, but my VB skills are about as basic as they come and I can't make it work. The error is on the "cdt =" line
Run-time error '-2147467259 (80004005)':
Automation error
Unspecified error
Public Sub tst_cd()
'm_tst_cd Get file create date for worksheet name and report range
Dim cdt As Date
cdt = ActiveWorkbook.BuiltinDocumentProperties.Item("Creation date")
Workbooks("Investigation_Pending_Running_Report.XLSX").Activate
Worksheets("Report").Activate
Range("D" & Cells.Rows.Count).End(xlUp).Offset(1, 0).Select
Debug.Print cdt
End Sub
As always, with deep appreciation!
Ron
Run-time error '-2147467259 (80004005)':
Automation error
Unspecified error
Public Sub tst_cd()
'm_tst_cd Get file create date for worksheet name and report range
Dim cdt As Date
cdt = ActiveWorkbook.BuiltinDocumentProperties.Item("Creation date")
Workbooks("Investigation_Pending_Running_Report.XLSX").Activate
Worksheets("Report").Activate
Range("D" & Cells.Rows.Count).End(xlUp).Offset(1, 0).Select
Debug.Print cdt
End Sub
As always, with deep appreciation!
Ron
Last edited: