First timer: Saving a file on a network drive

assassin3212

New Member
Joined
Mar 23, 2011
Messages
1
Hello everyone

I am pretty handy in Excel but have just started to dip my toes into VBA.

I have created a sheet where the user inputs their name in cell A1, and the date in DDMMYYYY format in cell 2. I then have a hidden cell (D40) with CONCATENATE formula to pull both of the above figures into one cell. I'd like to use this value as the file name when saving which will be saved in a folder on my Company's network drive. I'd like to add a button to do the below:

- 'Save As' the file on the shared area of the network:
//DFS/shared/finance_Monitoring_Software/FY11/New Attribute Values
- Save as with a file name of the value in cell D40
- Close the file down

I've come across the below on the 'net which does not seem to be working:

Sub SaveWithVariableFromCell()
SaveName = ActiveSheet.Range("D40").Text
ActiveWorkbook.Close Filename:="//DFS/shared/finance_monitoring_software/FY11/New Attribute Values" & SaveName & ".xls"
End Sub

Does the above look like it should work for me?

Huge thanks in advance
 

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.
Have you set the SaveName as a String?

Code:
Sub SaveWithVariableFromCell()
 
Dim SaveName As String
 
SaveName = ActiveSheet.Range("D40").Text
ActiveWorkbook.Close Filename:="//DFS/shared/finance_monitoring_software/FY11/New Attribute Values" & SaveName & ".xls"
End Sub
 
Upvote 0
Looks to me like it's missing a path separator after Attribute Values. And you need write permission for the folder.

EDIT: And it should be

Code:
ActiveWorkbook[COLOR=red].SaveAs[/COLOR] Filename:=...
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,911
Messages
6,122,199
Members
449,072
Latest member
DW Draft

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