Riaaz66
10-21-2010, 12:16 AM
Hi,
I'm using the vba-code below, to import a worksheet from another excel file to my workbook.
From the file that's being imported, I want to have the 'date created' into a cell of my workbook. Is that possible?
Here's the code I use to import an excel file:
Sub Get_Exact_Data()
'Original VBA code name "OpenExcelFile"
Dim vFile As Variant
Application.ScreenUpdating = False
Sheets("Exact Data").Select
Range("A1:Z10000").Select
Selection.Clear
Application.ScreenUpdating = True
'Showing Excel Open Dialog Form
vFile = Application.GetOpenFilename("XLS Files (*.xls)," & _
"*.xls", 1, "Select Excel File", "Open", False)
'If Cancel then exit
If TypeName(vFile) = "Boolean" Then
Exit Sub
End If
'Empty clipboard
Application.CutCopyMode = False
'Open selected file
Workbooks.Open vFile
ChDir _
"H:\Exactdat\"
'ActiveWorkbook.SaveAs Filename:="H:\Exactdat\Exact_Recon_Test.xls" _
', FileFormat:=xlXLSSpreadsheet, ReadOnlyRecommended:=False, CreateBackup:=False
Columns("A:L").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=-10000
Windows("G1 vs Exact Recon Tool - v1.xls").Activate
Sheets("Exact Data").Select
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
Windows("Exact_Recon_Test.xls").Activate
ActiveWorkbook.Close
Windows("G1 vs Exact Recon Tool - v1.xls").Activate
Sheets("Exact Data").Select
Range("A1").Select
Sheets("Main").Select
End Sub
Regards,
RM
I'm using the vba-code below, to import a worksheet from another excel file to my workbook.
From the file that's being imported, I want to have the 'date created' into a cell of my workbook. Is that possible?
Here's the code I use to import an excel file:
Sub Get_Exact_Data()
'Original VBA code name "OpenExcelFile"
Dim vFile As Variant
Application.ScreenUpdating = False
Sheets("Exact Data").Select
Range("A1:Z10000").Select
Selection.Clear
Application.ScreenUpdating = True
'Showing Excel Open Dialog Form
vFile = Application.GetOpenFilename("XLS Files (*.xls)," & _
"*.xls", 1, "Select Excel File", "Open", False)
'If Cancel then exit
If TypeName(vFile) = "Boolean" Then
Exit Sub
End If
'Empty clipboard
Application.CutCopyMode = False
'Open selected file
Workbooks.Open vFile
ChDir _
"H:\Exactdat\"
'ActiveWorkbook.SaveAs Filename:="H:\Exactdat\Exact_Recon_Test.xls" _
', FileFormat:=xlXLSSpreadsheet, ReadOnlyRecommended:=False, CreateBackup:=False
Columns("A:L").Select
Selection.Copy
ActiveWindow.SmallScroll Down:=-10000
Windows("G1 vs Exact Recon Tool - v1.xls").Activate
Sheets("Exact Data").Select
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
Windows("Exact_Recon_Test.xls").Activate
ActiveWorkbook.Close
Windows("G1 vs Exact Recon Tool - v1.xls").Activate
Sheets("Exact Data").Select
Range("A1").Select
Sheets("Main").Select
End Sub
Regards,
RM