Hi SoftAid, heb de code zoals hij nu gemaakt is hieronder geplaatst.
Ik heb de tabbladen dus eerst geselecteerd n.a.v. wat Della schreef.
Sub SavePDF()
'
Sheets("Fotos").Select
Sheets("Fotos").Move After:=Sheets(3)
Sheets(Array("Gegevens Import", "Fotos")).Select
Sheets("Gegevens Import").Activate
Dim wsA As Worksheet
Dim wbA As Workbook
Dim strTime As String
Dim strName As Variant
strName = Range("L3").Value
Dim strPath As String
Dim strFile As String
Dim strPathFile As String
Dim myFile As Variant
On Error GoTo errHandler
Set wbA = ActiveWorkbook
Set wsA = ActiveSheet
strTime = Format(Now(), "dd-mm-yyyy\_hh-mm")
'get active workbook folder, if saved
strPath = wbA.Path
If strPath = "" Then
strPath = Application.DefaultFilePath
End If
strPath = strPath & "\"
'create default name for savng file
strFile = strName & "_" & strTime & ".pdf"
strPathFile = strPath & strFile
'use can enter name and
' select folder for file
myFile = Application.GetSaveAsFilename _
(InitialFileName:=strPathFile, _
FileFilter:="PDF Files (*.pdf), *.pdf", _
Title:="Kies de juiste map en pas eventueel de bestandsnaam aan!")
'export to PDF if a folder was selected
If myFile <> False Then
wsA.ExportAsFixedFormat _
Type:=xlTypePDF, _
fileName:=myFile, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
'confirmation message with file info
MsgBox "PDF file is opgeslagen!" _
& vbCrLf _
& myFile
Else
MsgBox "PDF file is niet opgeslagen"
End If
'
Sheets("Belijningsvlakken - inspectie").Select
ActiveWindow.SelectedSheets.Visible = False
exitHandler:
Exit Sub
errHandler:
MsgBox "PDF file is niet opgeslagen"
Resume exitHandler
End Sub