eaddi
08-10-2012, 10:26 AM
Hello,
I need help with the following code. I want to create a PDF and save it to a fixed location using a cell as the file name. The area hilited in red is where I am having troubles. Can someone help? If I remove the range the code works perfect. Same is true if I remove the file location name.
Sub RDB_Worksheet_Or_Worksheets_To_PDF()
Dim FileName As String, fname As String
If ActiveWindow.SelectedSheets.Count > 1 Then
MsgBox "There is more then one sheet selected," & vbNewLine & _
"be aware that every selected sheet will be published"
End If
'Call the function with the correct arguments
'Tip: You can also use Sheets("Sheet3") instead of ActiveSheet in the code(sheet not have to be active then)
FileName = RDB_Create_PDF(ActiveSheet,"O:\J\Activity Report\Activity Report\ & Range("C27").Value", True, False)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(ActiveSheet, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
End If
End Sub
I need help with the following code. I want to create a PDF and save it to a fixed location using a cell as the file name. The area hilited in red is where I am having troubles. Can someone help? If I remove the range the code works perfect. Same is true if I remove the file location name.
Sub RDB_Worksheet_Or_Worksheets_To_PDF()
Dim FileName As String, fname As String
If ActiveWindow.SelectedSheets.Count > 1 Then
MsgBox "There is more then one sheet selected," & vbNewLine & _
"be aware that every selected sheet will be published"
End If
'Call the function with the correct arguments
'Tip: You can also use Sheets("Sheet3") instead of ActiveSheet in the code(sheet not have to be active then)
FileName = RDB_Create_PDF(ActiveSheet,"O:\J\Activity Report\Activity Report\ & Range("C27").Value", True, False)
'For a fixed file name and overwrite it each time you run the macro use
'RDB_Create_PDF(ActiveSheet, "C:\Users\Ron\Test\YourPdfFile.pdf", True, True)
If FileName <> "" Then
'Ok, you find the PDF where you saved it
'You can call the mail macro here if you want
Else
End If
End Sub