Hi Guys,
I'm trying to alter the below code so that I can save the activesheet in specific folders depending on what is in b12 and b13, but with no avail.
The save as pdf part works but i cant save it to specific folders that relate to the cell data.
if someone could help me, that would be great :smile:
Thanks in advance
Code
Sub SaveActiveSheet()
Const strPath As String = "C:\Documents and Settings\MyName\My Documents\Reports\& CellName1\& CellName2"
Dim strFile As String
Dim CellName1
Dim CellName2
CellName1 = Range("b12").Value
CellName2 = Range("b13").Value
With Sheet2
'check for Account Details'
If .Range("B16").Value = "" Or .Range("H10").Value = "" Then
MsgBox "Please enter Account Details. ", _
vbExclamation, "Missing Account"
Else
strFile = .Range("B16").Value & " " & .Range("H10").Value
.Copy 'Copy sheet2 to a new workbook
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
strPath & strFile & ".pdf", Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End If
End With
End Sub
Display More