Saving to network path with variable file name

mykulpasskwa

Board Regular
Joined
Mar 20, 2018
Messages
66
Hi there. I've been googling all morning trying to figure this out, and I've looked at the MS help among other forums but no luck.

I want to save a workbook to a specific network path and also save it under a filename with the variable ID and " - Account Overview" (e.g. "012345678 - Account Overview"). I have a command button the user can click, but I also have a worksheet calculate set up to prompt the user if they want to save if two values match. The idea is that the user has a chance to save if they forget to after filling in the sheet (happens a lot), but also that it saves to a place others can access it later on. I still want to give them the choice to change the location with the SaveAs dialogue box, but in most cases they'll save to our shared location.

I have either (1) been able to open the SaveAs dialogue box where the File Name is blank or (2) the file name is filled out correctly but the path doesn't open to the shared drive, but I haven't been able to save to the share drive with file name I want. For what it's worth I've checked the pathname multiple times to make sure its correct. The code below goes to the path but the File Name is blank. Anyone have any ideas what's wrong?

VBA Code:
Public Sub cbSave_Click()
    Dim FName As String
    Dim ID As Variant

        ID = ActiveSheet.Range("ShID").Value
        FName = Application.GetSaveAsFilename("\\server\folder\" & ID & " - Account Overview")

        
End Sub
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Watch MrExcel Video

Forum statistics

Threads
1,130,210
Messages
5,640,861
Members
417,174
Latest member
diegomuser

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
Top