Save As file name-Macro

dlove

New Member
Joined
Mar 20, 2009
Messages
34
Ok,

I have a macro recorded that saves the workbook to my desktop and then saves an additional copy to a shared drive. Right now it wants to save my file as the same name every time and ask to replace the existing copy.

What I would like to tell it to do is make the save as name reference cell D10. Unfortunatley, I don't know how to tell it to do that in visual basic.

Any assistance?
 
dlove

ChDir "Z:\Quoting Inventory Base Data"

Will not work, if Drive Z is on the Network.
Get the shared name for that drive that begins from "\\"
Rich (BB code):
Sub SaveQuote()
Dim myDeskTop As String
myDeskTop = CreateObject("WScript.Shell").SpecialFolders("desktop")
ActiveWorkbook.SaveAs Filename:= _
myDeskTop & "\" & Sheets("Sheet1").Range("D10").Value & ".xls", _
FileFormat:=xlExcel8, Password:="VelvetSweatshop", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
CreateObject("WScript.Shell").CurrentDirectory = _
      " \\server\Quoting Inventory Base Data\ "  '<- change here
ActiveWorkbook.SaveAs Filename:= _
Sheets("Sheet1").Range("D10").Value & ".xls", FileFormat:= _
xlExcel8, Password:="VelvetSweatshop", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Range("Q36").Select
End Sub
<!-- / message -->
 
Upvote 0

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,216,051
Messages
6,128,503
Members
449,455
Latest member
jesski

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