VBA problems saving file with new name + ignoring error handling?

Steph77

Board Regular
Joined
Sep 18, 2014
Messages
119
Hi all

I've lurked this forum for a long time and found it massively useful, so first of all in my first ever post here let me just say THANK YOU for all the help you've all already given me.

I'm having some problem with some code I wrote and I just can't figure it out:

Code:
MsgBox "Select a folder where you wish to save the Go Live Updates report."

On Error GoTo GLUErrorHandling
Set diaFolder = Application.FileDialog(msoFileDialogFolderPicker)
diaFolder.AllowMultiSelect = False
diaFolder.Title = "Select a folder to save the Go Live Updates Report"
diaFolder.Show

Debug.Print diaFolder.SelectedItems(1)

UpdateFName = "Go Live Updates Report " & Format(Date, "dd-mm-yy") & ".xlsx"
UpdateFPath = diaFolder.SelectedItems(1) & "\" & UpdateFName

Debug.Print UpdateFName
Debug.Print UpdateFPath

ActiveWorkbook.SaveAs Filename:=UpdateFPath

MsgBox "A Workbook with the filename """ & UpdateFName & """ has been saved in the specified folder"

Exit Sub

GLUErrorHandling:

MsgBox "You have not yet saved a copy of this file"

End Sub

I put the debug prints in there to try and see what it was doing and I'm getting the correct values that I expect for all 3, but instead of getting the textbox saying the file has been saved I'm getting the error handling text box saying it hasn't (and no file is being saved). I don't understand how I'm getting the debug prints if it's not doing the save....

I've been trying to figure out the problem here for ages and I can't seem to find it. Getting stressed out now. Please save my laptop from being thrown out of the window....

Thanks again and also in advance for any tips
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
LOL never mind - I found the fault.

I should have had:

ActiveWorkbook.SaveAs Filename:=UpdateFPath, FileFormat:=51

Thanks anyway peeps, I know you would have let me know if my next google hadn't found the pot'o'gold with the answer.

This thread can be marked as answered or closed or whatever you guys do to them here
 
Upvote 0

Forum statistics

Threads
1,214,929
Messages
6,122,317
Members
449,081
Latest member
tanurai

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