jmacalpine
asked on
VBA Error
I have a VBA script to run.. Get an error 5 When I try to run..Upon debugging, I am told that the Line (I've underlined it) below is using the wrong argument... I've tried a few different ways to declare that worksheet as the one I need but to no avail.
Thoughts?
Sub Tally()
Dim subj As String
subj = Worksheets("Bol Breakdown").Range("R1").Va lue
company = Worksheets("New").Range("N 1").Value
filesformat = "PDF\Tally Sheets"
livescrap = Worksheets("New").Range("N 3").Value
yeardate = Worksheets("New").Range("N 4").Value
monthdate = Worksheets("New").Range("N 5").Value
pathtosaveto = "S:\ARC\" & company & "\" & filesformat & "\" & yeardate & "\" & monthdate & "\" & subj
Worksheets("BOL Breakdown").ExportAsFixedF ormat Type:=xlTypePDF, Filename:=pathtosaveto, Quality:=xlQualityStandard , IncludeDocProperties:=True , IgnorePrintAreas:=False, OpenAfterPublish:=False
Thoughts?
Sub Tally()
Dim subj As String
subj = Worksheets("Bol Breakdown").Range("R1").Va
company = Worksheets("New").Range("N
filesformat = "PDF\Tally Sheets"
livescrap = Worksheets("New").Range("N
yeardate = Worksheets("New").Range("N
monthdate = Worksheets("New").Range("N
pathtosaveto = "S:\ARC\" & company & "\" & filesformat & "\" & yeardate & "\" & monthdate & "\" & subj
Worksheets("BOL Breakdown").ExportAsFixedF
Well I don't know what is in your "pathtosaveto" but otherwise your code works for me. If the sheet name were incorrect you'd get a Subscript out of range error.
ASKER
pathtosaveto = "S:\ARC\" & company & "\" & filesformat & "\" & yeardate & "\" & monthdate & "\" & subj
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.