frank_m
10-26-2010, 12:58 AM
My question is below this code:
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 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:
InitFileName = "C:\Users\Owner\Desktop\" & Range("I4").Value & "_" & strDate To this:
InitFileName = "\\CompanyShare\folder1\" & Range("I4").Value & "_" & strDate 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.
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 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:
InitFileName = "C:\Users\Owner\Desktop\" & Range("I4").Value & "_" & strDate To this:
InitFileName = "\\CompanyShare\folder1\" & Range("I4").Value & "_" & strDate 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.