Caveman1964
Board Regular
- Joined
- Dec 14, 2017
- Messages
- 127
- Office Version
- 2016
- Platform
- Windows
Hi, I am stuck.
I want to create a folder named from a cell, then another directory from a cell then a report filename from cell + report for example 123456report.
My below VBA worked with one sub directory but not two.....the below is what I did to attempt this but it is not working....it creates the first folder but not the second. Need help really bad. Cant figure out.
I am looking to do this;
P:\Job Packets\Product\Lot\SallyReport.xlsm
Below does not work, it makes the Product folder but nothing else.
Sub createreports ()
Windows("Reportsfromusers.xlsm").Activate
With Sheets(3)
If .Range("H2").Value = vbNullString Then Exit Sub
On Error Resume Next
MkDir "P:\Job Packets" & .Range("H2").Value
On Error GoTo 0
NewFN = "P:\Job Packets" & .Range("H2").Value & "" & .Range("E3").Value & "" & .Range("E3").Value & "LotMaterial" & ".xlsm"
ActiveWorkbook.SaveAs NewFN, FileFormat:=52
ActiveWorkbook.Close
Appreciate any help.
I want to create a folder named from a cell, then another directory from a cell then a report filename from cell + report for example 123456report.
My below VBA worked with one sub directory but not two.....the below is what I did to attempt this but it is not working....it creates the first folder but not the second. Need help really bad. Cant figure out.
I am looking to do this;
P:\Job Packets\Product\Lot\SallyReport.xlsm
Below does not work, it makes the Product folder but nothing else.
Sub createreports ()
Windows("Reportsfromusers.xlsm").Activate
With Sheets(3)
If .Range("H2").Value = vbNullString Then Exit Sub
On Error Resume Next
MkDir "P:\Job Packets" & .Range("H2").Value
On Error GoTo 0
NewFN = "P:\Job Packets" & .Range("H2").Value & "" & .Range("E3").Value & "" & .Range("E3").Value & "LotMaterial" & ".xlsm"
ActiveWorkbook.SaveAs NewFN, FileFormat:=52
ActiveWorkbook.Close
Appreciate any help.