Save file to Network Drive

santeria

Well-known Member
Joined
Oct 7, 2003
Messages
1,844
I'm just trying to Figure out what to change for a network file save.
Probably something amazingly basic...

However, I have...

Code:
Sub SAVECMSDAILYNETWORK()
'
' SAVECMSDAILYNETWORK Macro
' Macro recorded 2/24/2004 
'

'
    Windows("M:\REPORTS\02_FEBRUARY SUMMARY\CMS Daily.xls").Activate
    ChDir "E:\HR Outsourcing\Benefits\Reports"
    ActiveWorkbook.SaveAs Filename:= _
        "E:\HR Outsourcing\Benefits\Reports\CMS Daily2.xls", FileFormat:=xlNormal, _
        Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
        CreateBackup:=False
    ActiveWorkbook.Close
End Sub

And I need to know what to change to make the thing work.

Ta

(y)
 
such and such a file already exists, do you want to over-write
Application.DisplayAlerts = False will stop that. Just set it to True at the end of your code.

Smitty
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Thanks, I have that covered.
I learned that from you previously.

I appreciate the comment.

I just can't figure the rest of the code.

Quite a quest for a few lines :)

Ta

(y)
 
Upvote 0
Have you tried to replace the network drive letter by the drive name.
I'm not sure if it like this everywhere, suppose it depends which kind of server you have.

Here all our network drives have letters but also "names"
for example a path could look like : \\networkdrive\\data\file1.xls

I prefer to use the drive names is in my code as drive letter change more often and crewup our macros.
 
Upvote 0
Thanks for the thought.

The Path is not at issue.
It seems like I have to have a designator for the file to be saved as another file name.

Thats the thing thats confusing.
I've gone through a bunch of code, but nothing does the trick.

I know How to start and end the thing, and where to point the file references, it's the tag references at the start of the line that seem to be the pain.

Ta

(y)
 
Upvote 0
Sure

Code:
Sub SAVECMSDAILYNETWORK()
  Dim fname As String
With Application
        .DisplayAlerts = False
        .ScreenUpdating = False
    End With
fname = ("M:\REPORTS\02_FEBRUARY SUMMARY\CMS Daily")
Stringfname.SaveAs "E:\HR Outsourcing\Benefits\Reports\CMS Daily2.xls"
      ActiveWorkbook.Close
With Application
        .DisplayAlerts = True
        .ScreenUpdating = True
    End With
End Sub

Ta

(y)
 
Upvote 0
That seems straightforward enough, but I think that:

fname = ("M:\REPORTS\02_FEBRUARY SUMMARY\CMS Daily")
Stringfname.SaveAs "E:\HR Outsourcing\Benefits\Reports\CMS Daily2.xls"

Should be:

fname = ("M:\REPORTS\02_FEBRUARY SUMMARY\CMS Daily")
fname.SaveAs "E:\HR Outsourcing\Benefits\Reports\CMS Daily2.xls"

Smitty
 
Upvote 0
Just tried it.

Dies on the "fname.Saveas.." Line.

I am guessing it is something basic, but I am not sure.

Ta

(y)
 
Upvote 0
Doh!

Missed this:

fname.SaveAs Filename:="E:\HR Outsourcing\Benefits\Reports\CMS Daily2.xls"

Smitty

EDIT: Bolded the missing bit
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,695
Members
448,979
Latest member
DET4492

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