Dear members,
I have developed a macro to export from excel to PDF.
The strange thing is when I run the macro directly from the VBA editor, the PDF file looks proper.
However when I use a button to run the macro, the image I use in the excel sheet does have a light grey border among the picture.
Is there a difference between running a macro from the editor directly or from a command button?
Bellow you will see my macro, excuse me from the dutch text in it
I have developed a macro to export from excel to PDF.
The strange thing is when I run the macro directly from the VBA editor, the PDF file looks proper.
However when I use a button to run the macro, the image I use in the excel sheet does have a light grey border among the picture.
Is there a difference between running a macro from the editor directly or from a command button?
Bellow you will see my macro, excuse me from the dutch text in it
Code:
Sub PDFgenererenCSS()
Dim PdfName As String
If Sheet1.Range("I2") = "" Then
PdfName = Sheet1.Range("H2").Value & "van" & Sheet1.Range("H3").Value & "-" & Sheet1.Range("C9").Value & "-CSS"
Else
PdfName = Sheet1.Range("H2").Value & "van" & Sheet1.Range("H3").Value & "-" & Sheet1.Range("C9").Value & "-CSS Rev" & Sheet1.Range("I2").Value
End If
If Sheet1.Range("H2") = "" Then
MsgBox "Vul een waarde in bij cel H2"
Exit Sub
Else
If Sheet1.Range("H3") = "" Then
MsgBox "Vul een waarde in bij cel H3"
Exit Sub
Else
If Sheet1.Range("C9") = "" Then
MsgBox "Vul een waarde in bij cel C9"
Exit Sub
Else
If Dir("D:\LWARKEST\Desktop\" & PdfName & ".pdf") <> "" Then
If Sheet1.Range("q16") = "" Then
If MsgBox("Het bestand: " & PdfName & ".pdf bestaat al, wilt u deze overschrijven?", vbOKCancel) = vbOK Then
Sheet2.ExportAsFixedFormat Type:=xlTypePDF, Filename:="D:\LWARKEST\Desktop\" & PdfName & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, From:=1, To:=1, OpenAfterPublish:=True
MsgBox "uw document is opgeslagen", vbInformation
End If
Else
If MsgBox("Het bestand: " & PdfName & ".pdf bestaat al, wilt u deze overschrijven?", vbOKCancel) = vbOK Then
Sheet2.ExportAsFixedFormat Type:=xlTypePDF, Filename:="D:\LWARKEST\Desktop\" & PdfName & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, From:=1, To:=2, OpenAfterPublish:=True
MsgBox "uw document is opgeslagen", vbInformation
End If
End If
Else
If Sheet1.Range("q16") = "" Then
Sheet2.ExportAsFixedFormat Type:=xlTypePDF, Filename:="D:\LWARKEST\Desktop\" & PdfName & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, From:=1, To:=1, OpenAfterPublish:=True
MsgBox "uw document is opgeslagen", vbInformation
Else
Sheet2.ExportAsFixedFormat Type:=xlTypePDF, Filename:="D:\LWARKEST\Desktop\" & PdfName & ".pdf", Quality:=xlQualityStandard, IncludeDocProperties:=False, IgnorePrintAreas:=False, From:=1, To:=2, OpenAfterPublish:=True
MsgBox "uw document is opgeslagen", vbInformation
End If
End If
End If
End If
End If
End Sub