Hi, Im trying to create a directory and then export a pdf into this directory. What I have currently works but I would like to avoid overwriting older files that may have same filename. I would like to add another folder with todays date.
Everything I tried gives me errors.
Thanks in advance!
Small portion of code
I want to end up having C:\LabReports\12Sep2013 "filename from cell c8 in current sheet"
Everything I tried gives me errors.
Thanks in advance!
Small portion of code
I want to end up having C:\LabReports\12Sep2013 "filename from cell c8 in current sheet"
Code:
On Error Resume Next
MkDir "C:\LabReports\"
On Error GoTo 0
Sheets("Single Well Data Input").Select
If ActiveSheet.Range("B8").Value = "" Then GoTo error
Range("B8:Z8").Select
Selection.Copy
Range("Table14[Well Name]").Select
ActiveSheet.Paste
Sheets("Water Analysis").Select
Application.CutCopyMode = False
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:="C:\LabReports\" & Range("c8").Value _
, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
:=False, OpenAfterPublish:=False