I need to print the name of the file that I open into excel and the date it was created (or opened) onto cells H5 and I5
so far, opening the file is this...
sub open()
sFileName = Application.GetOpenFilename
If sFileName = False Then
Exit Sub
End If
MyWorkBook = ActiveWorkbook.name
'Clear the sheet
ActiveSheet.Cells.Clear
'open the specified file
Workbooks.Open (sFileName)
'set a variable to the file name (gets name of file without path)
CBook = ActiveWorkbook.name
'copy the data range
Range("A:D").Copy
'go back to the original workbook
Windows(MyWorkBook).Activate
'code to select the proper cell to paste to
Cells(1, 1).Select
ActiveSheet.Paste
end sub
any ideas?
Bookmarks