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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
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,224,599
Messages
6,179,831
Members
452,947
Latest member
Gerry_F

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