Hi all,
I am running the Macro below to export to pdf a document.
It has worked perfectly for over a week up until today and I am not sure why I am now getting the error message. It appears that it wont save the pdf at all as the pdf file does not get created or shown on screen.
My complete macro is actually three modules, copy data to another excel sheet, print sheet and then export copy to pdf. Code as follows:
Module 1
Sub Copy_data_base()
Application.ScreenUpdating = False
Dim copySheet As Worksheet
Dim pasteSheet As Worksheet
Set copySheet = Worksheets("Data Collection")
Set pasteSheet = Worksheets("Database")
copySheet.Range("A6:LW6").Copy
pasteSheet.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub
Module 2
Sub Print_Mix_Sheet()
Sheet1.Range("A1:Q39").PrintOut
End Sub
Module 3
Sub Export_Mix_Sheet_pdf()
Application.ScreenUpdating = False
Sheets("Worksheet").Select
Range("A1:T39").Select
Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"\\Server\Folder1\Folder2\Subfolder\" & Range("B2") & " " & Range("C2").Value & " " & Format(Now, "yyyy_mm_dd_hhmmss"), Quality:=xlQualityStandard, IncludeDocProperties:= _
True, IgnorePrintAreas:=True, OpenAfterPublish:=True
Sheets("Worksheet").Select
Range("B1").Select
Application.ScreenUpdating = False
End Sub
Module 4
Sub Button_1()
Call Copy_data_base
Call Print_Mix_Sheet
Call Export_Mix_Sheet_pdf
End Sub
The error message I get today is Run-time error 1004: Document not saved. The document may be open, or an error may have been encountered when saving.
Please could somebody offer me an explanation as to why this has suddenly started happening and how I may be able to go about fixing it? I suspect the pdf engine is running in the background but looking at active processes I can see only the adobe update which as it happens doesnt appear to show an update is in progress.
Thank you for any help.
Thank you
Bookmarks