Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a simple save routine which saves the file to my own c drive and then
a copy to a network drive. How can I run the sproceedure and trap the error if the pc is not connected to the network. Also would it be possible to trap another error - say if the file had been opened by someone using the network drive copy, to ignore the second part of the routine too and perhaps send a message back to the user that it has been saved to the local drive but not the network. Sub SaveOptions() ' ' SaveOptions Macro ' Macro recorded 25/09/2006 by Gary Mallin 'Save to own hard-drive ChDir "C:\Documents and Settings\malling\My Documents\Gary's Documents" ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\malling\My Documents\Gary's Documents\TOIL 2006-2007 Gary.xls" _ , FileFormat:=xlNormal, Password:="gazzaflexi", WriteResPassword:= _ "", ReadOnlyRecommended:=False, CreateBackup:=False 'Save to Network Drive ChDir "Z:\man ac\Preston06-07\TOIL" ActiveWorkbook.SaveAs Filename:= _ "Z:\man ac\Preston06-07\TOIL\TOIL 2006-2007 Gary.xls", FileFormat:=xlNormal, _ Password:="gazzaflexi", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False End Sub As always help from this forum greatly appreciated Gaz |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub SaveOptions()
' ' SaveOptions Macro ' Macro recorded 25/09/2006 by Gary Mallin 'Save to own hard-drive ChDir "C:\Documents and Settings\malling\My Documents\Gary's Documents" ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\malling\My Documents\Gary's Documents\TOIL 2006-2007 Gary.xls" _ , FileFormat:=xlNormal, Password:="gazzaflexi", WriteResPassword:= _ "", ReadOnlyRecommended:=False, CreateBackup:=False 'Save to Network Drive on error Resume Next ChDir "Z:\man ac\Preston06-07\TOIL" ActiveWorkbook.SaveAs Filename:= _ "Z:\man ac\Preston06-07\TOIL\TOIL 2006-2007 Gary.xls", FileFormat:=xlNormal, _ Password:="gazzaflexi", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False On Error goto 0 if Left(Activeworkbook.Path,1) < "Z" then msgbox "Only saved to local drive" end if End Sub -- Regards, Tom Ogilvy "Gazza" <mallin"nospam" wrote: I have a simple save routine which saves the file to my own c drive and then a copy to a network drive. How can I run the sproceedure and trap the error if the pc is not connected to the network. Also would it be possible to trap another error - say if the file had been opened by someone using the network drive copy, to ignore the second part of the routine too and perhaps send a message back to the user that it has been saved to the local drive but not the network. Sub SaveOptions() ' ' SaveOptions Macro ' Macro recorded 25/09/2006 by Gary Mallin 'Save to own hard-drive ChDir "C:\Documents and Settings\malling\My Documents\Gary's Documents" ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\malling\My Documents\Gary's Documents\TOIL 2006-2007 Gary.xls" _ , FileFormat:=xlNormal, Password:="gazzaflexi", WriteResPassword:= _ "", ReadOnlyRecommended:=False, CreateBackup:=False 'Save to Network Drive ChDir "Z:\man ac\Preston06-07\TOIL" ActiveWorkbook.SaveAs Filename:= _ "Z:\man ac\Preston06-07\TOIL\TOIL 2006-2007 Gary.xls", FileFormat:=xlNormal, _ Password:="gazzaflexi", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False End Sub As always help from this forum greatly appreciated Gaz |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks Tom
kind regards Gary "Tom Ogilvy" wrote in message ... Sub SaveOptions() ' ' SaveOptions Macro ' Macro recorded 25/09/2006 by Gary Mallin 'Save to own hard-drive ChDir "C:\Documents and Settings\malling\My Documents\Gary's Documents" ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\malling\My Documents\Gary's Documents\TOIL 2006-2007 Gary.xls" _ , FileFormat:=xlNormal, Password:="gazzaflexi", WriteResPassword:= _ "", ReadOnlyRecommended:=False, CreateBackup:=False 'Save to Network Drive on error Resume Next ChDir "Z:\man ac\Preston06-07\TOIL" ActiveWorkbook.SaveAs Filename:= _ "Z:\man ac\Preston06-07\TOIL\TOIL 2006-2007 Gary.xls", FileFormat:=xlNormal, _ Password:="gazzaflexi", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False On Error goto 0 if Left(Activeworkbook.Path,1) < "Z" then msgbox "Only saved to local drive" end if End Sub -- Regards, Tom Ogilvy "Gazza" <mallin"nospam" wrote: I have a simple save routine which saves the file to my own c drive and then a copy to a network drive. How can I run the sproceedure and trap the error if the pc is not connected to the network. Also would it be possible to trap another error - say if the file had been opened by someone using the network drive copy, to ignore the second part of the routine too and perhaps send a message back to the user that it has been saved to the local drive but not the network. Sub SaveOptions() ' ' SaveOptions Macro ' Macro recorded 25/09/2006 by Gary Mallin 'Save to own hard-drive ChDir "C:\Documents and Settings\malling\My Documents\Gary's Documents" ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\malling\My Documents\Gary's Documents\TOIL 2006-2007 Gary.xls" _ , FileFormat:=xlNormal, Password:="gazzaflexi", WriteResPassword:= _ "", ReadOnlyRecommended:=False, CreateBackup:=False 'Save to Network Drive ChDir "Z:\man ac\Preston06-07\TOIL" ActiveWorkbook.SaveAs Filename:= _ "Z:\man ac\Preston06-07\TOIL\TOIL 2006-2007 Gary.xls", FileFormat:=xlNormal, _ Password:="gazzaflexi", WriteResPassword:="", _ ReadOnlyRecommended:=False, CreateBackup:=False End Sub As always help from this forum greatly appreciated Gaz |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Saving Excel File to a Network Drive | Excel Discussion (Misc queries) | |||
Problem saving to network drive | Excel Programming | |||
Sporadic errors when saving to network drive | Excel Programming | |||
Excel 2003 - problem saving to a mapped network drive | Excel Discussion (Misc queries) | |||
Saving to network drive gives unwanted copy or overwrite message | Excel Discussion (Misc queries) |