Hoe en waar kan ik in onderstaande macro aangeven dat er voor het importeren in de specifieke map moet worden gekeken
c:\Prognoses\Artikelen\2017\
c:\Prognoses\Artikelen\2017\
Code:
Sub ImportSheet()
ActiveSheet.Name = "Prognose"
Dim sImportFile As String, sFile As String
Dim sThisBk As Workbook
Dim vfilename As Variant
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Set sThisBk = ActiveWorkbook
sImportFile = Application.GetOpenFilename( _
FileFilter:="Microsoft Excel Workbooks, *.xls; *.xlsx", Title:="Open Workbook")
If sImportFile = "False" Then
MsgBox "No File Selected!"
Exit Sub
Else
vfilename = Split(sImportFile, "\")
sFile = vfilename(UBound(vfilename))
Application.Workbooks.Open Filename:=sImportFile
Set wbBk = Workbooks(sFile)
With wbBk
If SheetExists("sheet1") Then
Sheets("Sheet1").Name = "import"
Set wsSht = .Sheets("import")
wsSht.Copy before:=sThisBk.Sheets("Prognose")
Else
MsgBox "There is no sheet with name :sheet1 in:" & vbCr & .Name
End If
wbBk.Close SaveChanges:=False
End With
End If
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub