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

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Forum statistics

Threads
1,223,162
Messages
6,170,431
Members
452,326
Latest member
johnshaji

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