Sub
Datenimport()
Dim
strInvoicePeriod
As
String
Dim
File
As
String
Dim
wkb
As
Excel.Workbook
Dim
oBlatt
As
Worksheet
strInvoicePeriod = InputBox(
"Which Invoice Period shall be imported? (e.g. 02-2020"
)
Do
Until
strInvoicePeriod <>
""
And
Len(strInvoicePeriod) = 7
strInvoicePeriod = InputBox(
"Please insert the following data! Which Invoice Period shall be imported? (e.g. 02-2020"
)
Loop
File = Application.GetOpenFilename()
On
Error
GoTo
ErrHandler
Application.ScreenUpdating =
False
Set
wkb = Workbooks.Open(File)
wkb.Sheets(1).Copy After:=ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count)
ThisWorkbook.Sheets(ThisWorkbook.Sheets.Count).Name = strInvoicePeriod
wkb.Close
False
Application.ScreenUpdating =
True