Hi. On occasion, I get a program crash when I run this macro to pub a cdr to pdf. I don't what causes it and I lose work sometimes. If anyone can check this code I'd be so grateful.
Sub PublishToPdf() Dim dn As String, ps As PDFVBASettings Set ps = ActiveDocument.PDFSettings If ActiveDocument.Dirty Then ActiveDocument.Save On Error GoTo ErrHandler 'ps.ShowDialog dn = Left$(ActiveDocument.FullFileName, Len(ActiveDocument.FullFileName) - 4) & ".pdf" ActiveDocument.PublishToPdf dn dn = Left$(ActiveDocument.FullFileName, Len(ActiveDocument.FullFileName) - 4) & ".pdf" ExitSub: Exit Sub ErrHandler: MsgBox "Error occured: " & Err.Description & Err.Number Resume ExitSub End Sub
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Can you please let us know what error you get at which line?
What are you doing in the time while saving? Maybe you activate a different document?