Hi guys,
I've mad a billing sheet in Excel 365.
When the file is in his orginal map on the PC, there is no problem with exporting to pdf and saving.
However: when I move the file to another map (or computer), saving the bill as .pdf gives an error.
What am I doing wrong?
Ramon
P.s.: some words are dutch:
- factuur = Bill
- Wordt niet meer gebruikt = Isn't used anymore
- Er is iets misgegaan = Error
Private Sub CommandButton2_Click()
MsgBox "WORDT NIET MEER GEBRUIKT"
' On Error GoTo ErrHandler:
' Dim FolderPath As String
'
' FolderPath = Application.ActiveWorkbook.path
' If Right(FolderPath, 1) <> "\" Then
' FolderPath = FolderPath & "\"
' End If
'
' FolderPath = FolderPath & "Facturen"
'
' If Dir(FolderPath, vbDirectory) = vbNullString Then
' MkDir FolderPath
' End If
'
'
' i = 1
' If isEmpty(Range("C13")) Then
' pdfname = "Factuur"
' Else
' pdfname = "Factuur " & Range("C13")
' End If
'
' If Dir(FolderPath & "\" & pdfname & ".pdf") <> "" Then
' Do While Dir(FolderPath & "\" & pdfname & ".pdf") <> ""
'
' If isEmpty(Range("C13")) Then
' pdfname = "Factuur " & " (" & i & ")"
' Else
' pdfname = "Factuur " & Range("C13") & " (" & i & ")"
' End If
'
' i = i + 1
' If i = 100 Then
' Exit Do
' End If
' Loop
' End If
' With ActiveSheet.PageSetup
' .LeftMargin = Application.InchesToPoints(0.1)
' .RightMargin = Application.InchesToPoints(0.1)
' .TopMargin = Application.InchesToPoints(0.3)
' .BottomMargin = Application.InchesToPoints(0.1)
' .HeaderMargin = Application.InchesToPoints(0.1)
' .FooterMargin = Application.InchesToPoints(0.1)
' .CenterHorizontally = True
' .CenterVertically = False
' End With
'
' ActiveSheet.Range("B1:E44").ExportAsFixedFormat Type:=xlTypePDF, Filename:=FolderPath & "\" & pdfname & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
' :=False, OpenAfterPublish:=True
' Exit Sub
'
'ErrHandler:
' MsgBox "Er is iets mis gegaan"
' Resume Next
End Sub
I've mad a billing sheet in Excel 365.
When the file is in his orginal map on the PC, there is no problem with exporting to pdf and saving.
However: when I move the file to another map (or computer), saving the bill as .pdf gives an error.
What am I doing wrong?
Ramon
P.s.: some words are dutch:
- factuur = Bill
- Wordt niet meer gebruikt = Isn't used anymore
- Er is iets misgegaan = Error
Private Sub CommandButton2_Click()
MsgBox "WORDT NIET MEER GEBRUIKT"
' On Error GoTo ErrHandler:
' Dim FolderPath As String
'
' FolderPath = Application.ActiveWorkbook.path
' If Right(FolderPath, 1) <> "\" Then
' FolderPath = FolderPath & "\"
' End If
'
' FolderPath = FolderPath & "Facturen"
'
' If Dir(FolderPath, vbDirectory) = vbNullString Then
' MkDir FolderPath
' End If
'
'
' i = 1
' If isEmpty(Range("C13")) Then
' pdfname = "Factuur"
' Else
' pdfname = "Factuur " & Range("C13")
' End If
'
' If Dir(FolderPath & "\" & pdfname & ".pdf") <> "" Then
' Do While Dir(FolderPath & "\" & pdfname & ".pdf") <> ""
'
' If isEmpty(Range("C13")) Then
' pdfname = "Factuur " & " (" & i & ")"
' Else
' pdfname = "Factuur " & Range("C13") & " (" & i & ")"
' End If
'
' i = i + 1
' If i = 100 Then
' Exit Do
' End If
' Loop
' End If
' With ActiveSheet.PageSetup
' .LeftMargin = Application.InchesToPoints(0.1)
' .RightMargin = Application.InchesToPoints(0.1)
' .TopMargin = Application.InchesToPoints(0.3)
' .BottomMargin = Application.InchesToPoints(0.1)
' .HeaderMargin = Application.InchesToPoints(0.1)
' .FooterMargin = Application.InchesToPoints(0.1)
' .CenterHorizontally = True
' .CenterVertically = False
' End With
'
' ActiveSheet.Range("B1:E44").ExportAsFixedFormat Type:=xlTypePDF, Filename:=FolderPath & "\" & pdfname & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
' :=False, OpenAfterPublish:=True
' Exit Sub
'
'ErrHandler:
' MsgBox "Er is iets mis gegaan"
' Resume Next
End Sub