Save Macro w Suggested File Name to Network Drive

J

John Michaels

I'm attempting the following macro which saves the file to a network
drive (with no errors)


ChDir "J:\"

ActiveWorkbook.SaveAs Filename:="J:\User.xls", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
ThisWorkbook.Close savechanges:=True

End Sub


so that the file will refer to a cell within the worksheet for the name
of the file to be saved to the same network drive


Range("B30").Select

ChDir "J:\"

ActiveWorkbook.SaveAs Filename:=ActiveCell.Value,
FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False,
_
CreateBackup:=False

ThisWorkbook.Close savechanges:=True

but as written, it saves to 'My Documents' vs the network drive. I'm
assuming that the "network drive letter" needs to be included with
[Filename:=ActiveCell.Value] but I've not been able to figure out how
to do it. Any help would be greatly appreciated!
 
L

Leith Ross

Hello John,

Try setting the drive first then the directory.

ChDrive "J"
ChDir("J:\")

That should solve the problem.

Sincerely,
Leith Ross
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top