VBA. Files will not save. Maybe I'm dumb?

hellfire45

Active Member
Joined
Jun 7, 2014
Messages
464
So the code below is supposed to create a folder (Which is does) and then save these 4 files to the folder. The problem is that it won't save them. The code does not error, but it won't save them. What am I missing here?

Thanks guys. I know one of you smarties can help me.


Code:
If Dir("I:\ASM\All\CRT\Reporting\In Consolidation Process\Master Automation\Saved CRT Uploads\" & Format(Date, "yyyy-mm-dd"), vbDirectory) = "" Then            
MkDir ("I:\ASM\All\CRT\Reporting\In Consolidation Process\Master Automation\Saved CRT Uploads\" & Format(Date, "yyyy-mm-dd") & "\")
End If
destinationpath = "I:\ASM\All\CRT\Reporting\In Consolidation Process\Master Automation\Saved CRT Uploads\" & Format(Date, "yyyy-mm-dd") & "\"


tracking_saveas = destinationpath & "CRT UPLOAD Tracking" & Format(Date, "mm/dd/yyyy") & ".xlsx"
serials_saveas = destinationpath & "CRT UPLOAD Serials" & Format(Date, "mm/dd/yyyy") & ".xlsx"
backlog_saveas = destinationpath & "CRT UPLOAD Backlog" & Format(Date, "mm/dd/yyyy") & ".xlsx"
shipments_saveas = destinationpath & "CRT UPLOAD ETAs from Shipments" & Format(Date, "mm/dd/yyyy") & ".xlsx"


Workbooks(CRT_Tracking).SaveAs filename:=tracking_saveas, FileFormat:=xlWorkbookNormal
Workbooks(CRT_Serials).SaveAs filename:=serials_saveas, FileFormat:=xlWorkbookNormal
Workbooks(CRT_Backlog).SaveAs filename:=backlog_saveas, FileFormat:=xlWorkbookNormal
Workbooks(CRT_Shipments).SaveAs filename:=shipments_saveas, FileFormat:=xlWorkbookNormal


Workbooks(CRT_Tracking).Close True
Workbooks(CRT_Serials).Close True
Workbooks(CRT_Backlog).Close True
Workbooks(CRT_Shipments).Close True
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Try changing
Code:
FileFormat:=xlWorkbookNormal
to
Code:
FileFormat:=51
 
Upvote 0
Oops, missed this
Code:
 Format(Date, "mm/dd/yyyy"
You cant use / as part of a filename. You'll need to use a different format
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top