Good afternoon,
I'm new to VB and I found this code, which worked for me perfectly fineyesterday, but now it just stopped doing anything. Does anyone know why itstopped, or is there something obvious I need to consider when trying totroubleshoot it? file path I correct, as are the cell locations referenced
Thank you in advance.
'-------------------------------------------------------------------------------
Sub Save_as_Pdfs()
'-------------------------------------------------------------------------------
' Saves marked sheets as PDF file.
Const PDF_path = "D:\PDF"
Dim Snr As Integer
Dim Name As String
'Process all sheets in workbook
For Snr = 1 To ActiveWorkbook.Sheets.Count
Sheets(Snr).Activate
'Only print if c4 contains "NOTE"
If Cells(4, "C").Value = "NOTE" Then
Name = PDF_path & ActiveSheet.Name & Cells(4, "B").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Name, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
End If
Next Snr
End Sub
I'm new to VB and I found this code, which worked for me perfectly fineyesterday, but now it just stopped doing anything. Does anyone know why itstopped, or is there something obvious I need to consider when trying totroubleshoot it? file path I correct, as are the cell locations referenced
Thank you in advance.
'-------------------------------------------------------------------------------
Sub Save_as_Pdfs()
'-------------------------------------------------------------------------------
' Saves marked sheets as PDF file.
Const PDF_path = "D:\PDF"
Dim Snr As Integer
Dim Name As String
'Process all sheets in workbook
For Snr = 1 To ActiveWorkbook.Sheets.Count
Sheets(Snr).Activate
'Only print if c4 contains "NOTE"
If Cells(4, "C").Value = "NOTE" Then
Name = PDF_path & ActiveSheet.Name & Cells(4, "B").Value & ".pdf"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Name, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=False
End If
Next Snr
End Sub