![]() ![]() You will see I even have a portion of the code to display the names of the sheets contained in mysheets1 that shows that the active sheet is not a part of the array but yet still shows up in the final product PDF. I have tried forcibly excluding it from the variant that contains the names of the sheets I desire to be printed as well as many other methods and just cant seem to get it to work. Resume EndMacro ' Go to EndMacro label to enable re-enabling display alerts and screen updating Save_PDF = False ' Return False to indicate error Please check your file path and try again." Here is what it looks like: Function CreatePDF (Myvar As Object, FixedFilePathName As String, OverwriteIfFileExist As Boolean, OpenPDFAfterPublish As Boolean) As String Dim FileFormatstr As String Dim FName As Variant 'Test If the Microsoft Add-in is installed If Dir (Environ. Shell "explorer.exe " & Chr(34) & SvAs & Chr(34), vbNormalFocusĪpplication.DisplayAlerts = True ' Added to re-enable display alertsĪpplication.ScreenUpdating = True ' Added to re-enable screen updating Since approximately one week ago, my print macro stopped working. ' Open the PDF file on the user's computer Save_PDF = True ' Return True to indicate successful execution LastRow = ws.Cells(ws.Rows.Count, "E").End(xlUp).RowĬurrentSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=SvAs, Quality:=xlQualityMaximum, IncludeDocProperties:=False, IgnorePrintAreas:=False SvAs = ThisWorkbook.Path & "\" & MyName & ".pdf" ' Updated the file save name with the full path Set ws = ThisWorkbook.Worksheets("Print Packages") ' Change "Print Packages" to the actual sheet name If there is a solution to this or a more efficient way to do this code as well please let me know.ĭim Thissheet As String, ThisFile As String, PathName As Stringĭim MyName As String ' Added variable declaration for MyNameĭim ws As Worksheet ' Added variable declaration for the worksheet ![]() For some reason, my code attaches the Print Packages sheet to the pdf it prints out, which I do not want it to do. This list starts in cell e13 on the "Print Packages" sheet of the workbook and proceeds vertically, (next sheet contained in e14, and e15, and so on). ![]() I essentially have a list of the names of sheets in the workbook that I want to use a macro button to print to a pdf. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |