-
Solved: Excel 2003 - Is it complicated to save to a shared network drive?
My question is below this code:
[vba]Private Sub CommandButton2_Click()
Dim wb As Workbook
Dim fileSaveName As String
Dim InitFileName As String
Dim strDate As String
strDate = Format(Now, "dd-mmm-yy h-mm-ss")
InitFileName = "C:\Users\Owner\Desktop\" & Range("I4").Value & "_" & strDate
Sheets(Array("Packing Slip", "C of C", "Invoice", "P Slip")).Copy
Set wb = ActiveWorkbook
fileSaveName = Application.GetSaveAsFilename(InitialFileName:=InitFileName, _
filefilter:="Excel files , *.xls")
If fileSaveName <> "False" Then
wb.SaveAs fileSaveName
wb.Close
Else
wb.Close False
Exit Sub
End If
End Sub[/vba] The code I put together above works fine to save four sheets as a new workbook.
I'm wondering if it will work if used with a shared network path
Changing this:
[vba]InitFileName = "C:\Users\Owner\Desktop\" & Range("I4").Value & "_" & strDate[/vba] To this:
[vba]InitFileName = "\\CompanyShare\folder1\" & Range("I4").Value & "_" & strDate[/vba] I only go into the factory a couple times a month so I have no way to test it. - I am hoping I do not need to use a big long API routine to get the save to path into my routine.
Thanks in advance for some insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules