ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
Morning,
I am using the following code supplied below.
The line of code in Red is where i am stuck at, currently it saves the file of which looks like example 1
Im looking to go one step more in that when the code is run i would like to create a folder,rename it as from valuw in cell C3 & then put this saved pdf inside it.
Please see example 2
Please look at screen shots supplied
I am using the following code supplied below.
The line of code in Red is where i am stuck at, currently it saves the file of which looks like example 1
Im looking to go one step more in that when the code is run i would like to create a folder,rename it as from valuw in cell C3 & then put this saved pdf inside it.
Please see example 2
Please look at screen shots supplied
Rich (BB code):
Private Sub GrassSummarySheet_Click()
Dim strFileName As String
strFileName = "C:\Users\Ian\Desktop\GRASS CUTTING\CURRENT GRASS SHEETS\SUMMARY SHEETS\" & "SUMMARY" & " " & Range("C3") & ".pdf"
If Dir(strFileName) <> vbNullString Then
MsgBox "GRASS SUMMARY SHEET " & Range("C3") & " WAS NOT SAVED AS IT ALREADY EXISTS", vbCritical + vbOKOnly, "GRASS SUMMARY SHEET MESSAGE"
Exit Sub
End If
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFileName, Quality:=xlQualityStandard, IncludeDocProperties:=True
MsgBox "GRASS SUMMARY SHEET " & Range("C3") & " WAS SAVED SUCCESSFULLY", vbInformation + vbOKOnly, "GRASS SUMMARY SHEET MESSAGE"
Range("D5:E17").ClearContents
Range("D21:E33").ClearContents
Range("C5").Select
ActiveWorkbook.Save
End With
End Sub