Greetings to all. This is my first post here but not my first visit by far. Over the last year I have used this forum to help me create a timesheet application for the company I work for. Let it be known that calling my skill level moderate would be gracious.
The application I have created works great...except for 1 thing. When an employee completed filling out the timesheet for the day, the Print button is pressed to run the macro below. The file is created and save exactly as intended exept that all 3 worksheets in the workbook are save in the PDF file. The main sheet for user interface, the worksheet with formulas, tables, etc. (neither of which need to be printed). And the timesheet template (that should print). The two added sheets are causing some storage issues on the server and some unwarranted ribbing from the cheap seats. I need to get rid of those 2 sheets.
I have tried various objects, print areas, cut and paste, delete worksheets etc. to no avail. Any help to print just the one sheet would be hugely appreciated.
Mike
========================================================
Sub SavePDF_Click()
'
'This macro prints the timesheet to the correct directory and filename as a PDF file
Dim StaticDirect As String
Dim WeekEndDirect As String
Dim DailyFile As String
Dim FileSaveDest As String
'Set the static part of the Directory path for saving the Daily Timesheet to a PDF file
StaticDirect = "C:\Time\"
'Set the value of the week ending part of the Directory path for saving the
'Daily Timesheet to a PDF file
WeekEndDirect = Range("WEndDate3").Value
'Set the value of the daily part of the filename
DailyFile = Range("Date3").Value
'Concatenate the Directory path and filename to create the Directory path and filename
'of the PDF file
FileSaveDest = StaticDirect & "WE " & WeekEndDirect & "\CPR Timesheet " & DailyFile
'Print and save the PDF file to the appropriate directory and filename
ActiveWorkbook.ExportAsFixedFormat xlTypePDF, FileSaveDest
End Sub
The application I have created works great...except for 1 thing. When an employee completed filling out the timesheet for the day, the Print button is pressed to run the macro below. The file is created and save exactly as intended exept that all 3 worksheets in the workbook are save in the PDF file. The main sheet for user interface, the worksheet with formulas, tables, etc. (neither of which need to be printed). And the timesheet template (that should print). The two added sheets are causing some storage issues on the server and some unwarranted ribbing from the cheap seats. I need to get rid of those 2 sheets.
I have tried various objects, print areas, cut and paste, delete worksheets etc. to no avail. Any help to print just the one sheet would be hugely appreciated.
Mike
========================================================
Sub SavePDF_Click()
'
'This macro prints the timesheet to the correct directory and filename as a PDF file
Dim StaticDirect As String
Dim WeekEndDirect As String
Dim DailyFile As String
Dim FileSaveDest As String
'Set the static part of the Directory path for saving the Daily Timesheet to a PDF file
StaticDirect = "C:\Time\"
'Set the value of the week ending part of the Directory path for saving the
'Daily Timesheet to a PDF file
WeekEndDirect = Range("WEndDate3").Value
'Set the value of the daily part of the filename
DailyFile = Range("Date3").Value
'Concatenate the Directory path and filename to create the Directory path and filename
'of the PDF file
FileSaveDest = StaticDirect & "WE " & WeekEndDirect & "\CPR Timesheet " & DailyFile
'Print and save the PDF file to the appropriate directory and filename
ActiveWorkbook.ExportAsFixedFormat xlTypePDF, FileSaveDest
End Sub