ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to Save on a Network Drive using UNC? (https://www.excelbanter.com/excel-programming/273312-how-save-network-drive-using-unc.html)

Scooby912

How to Save on a Network Drive using UNC?
 
Hi all,

I am trying to save a file onto a network drive. My problem is, several
different departments have different drive mappings. We all have different
drive letters for our shared directory, so I can't use my current
procedures...

Private Sub CommandButton_Click()
ChDrive "C"
ChDir "C:\Dir"
ActiveWorkbook.SaveAs "filename" & Format(Now, "mmddyy_hhmmss") &
".xls"
End Sub

Instead of using ChDrive "C" and ChDir "C:\Dir" can I use it's UNC
equivalent? and how do I do it?

Thanks,
Erwin



Rob Bovey

How to Save on a Network Drive using UNC?
 
Hi Erwin,

There's no need to change the current directory to save a workbook to a
specific location. You could save it to a UNC share like this:

ActiveWorkbook.SaveAs "\\Server\ShareName\Book1.xls"

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Scooby912" wrote in message
...
Hi all,

I am trying to save a file onto a network drive. My problem is, several
different departments have different drive mappings. We all have different
drive letters for our shared directory, so I can't use my current
procedures...

Private Sub CommandButton_Click()
ChDrive "C"
ChDir "C:\Dir"
ActiveWorkbook.SaveAs "filename" & Format(Now, "mmddyy_hhmmss") &
".xls"
End Sub

Instead of using ChDrive "C" and ChDir "C:\Dir" can I use it's UNC
equivalent? and how do I do it?

Thanks,
Erwin






All times are GMT +1. The time now is 07:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com