Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Is it possible to turn off errors in macros??? I want to save a file to a thumb drive but depending on where you are, Office or Home the drive location will be different. Office is x: and Home is f: I think the best way to accomplish what I need to do is to save the file on both locations. When the macro runs it is going to error out on one of the attempts to save but if I can some how turn off that function it will automatically save. This way there is no need to ask the user if he is at home or at work. Again, my programming ability is limited to hacking existing code and my searching the forums has not turned up anything like this. Thanks again for your help with this. It is much appreciated. -- sungen99 ------------------------------------------------------------------------ sungen99's Profile: http://www.excelforum.com/member.php...fo&userid=9144 View this thread: http://www.excelforum.com/showthread...hreadid=505730 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Error Resume Next
Insert this line at the beginning of your code. "sungen99" wrote: Is it possible to turn off errors in macros??? I want to save a file to a thumb drive but depending on where you are, Office or Home the drive location will be different. Office is x: and Home is f: I think the best way to accomplish what I need to do is to save the file on both locations. When the macro runs it is going to error out on one of the attempts to save but if I can some how turn off that function it will automatically save. This way there is no need to ask the user if he is at home or at work. Again, my programming ability is limited to hacking existing code and my searching the forums has not turned up anything like this. Thanks again for your help with this. It is much appreciated. -- sungen99 ------------------------------------------------------------------------ sungen99's Profile: http://www.excelforum.com/member.php...fo&userid=9144 View this thread: http://www.excelforum.com/showthread...hreadid=505730 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
This will work, but it will quash ALL errors ("Not enough space to save",
"Your computer is on fire", etc.), so use it with extreme caution. On Error Resume Next ' You save code goes here If Err.Number < 0 Then Err.Clear End If On Error GoTo 0 -- Hmm...they have the Internet on COMPUTERS now! "sungen99" wrote: Is it possible to turn off errors in macros??? I want to save a file to a thumb drive but depending on where you are, Office or Home the drive location will be different. Office is x: and Home is f: I think the best way to accomplish what I need to do is to save the file on both locations. When the macro runs it is going to error out on one of the attempts to save but if I can some how turn off that function it will automatically save. This way there is no need to ask the user if he is at home or at work. Again, my programming ability is limited to hacking existing code and my searching the forums has not turned up anything like this. Thanks again for your help with this. It is much appreciated. -- sungen99 ------------------------------------------------------------------------ sungen99's Profile: http://www.excelforum.com/member.php...fo&userid=9144 View this thread: http://www.excelforum.com/showthread...hreadid=505730 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
what is the purpose of the bottom 4 lines?
"MDW" wrote: This will work, but it will quash ALL errors ("Not enough space to save", "Your computer is on fire", etc.), so use it with extreme caution. On Error Resume Next ' You save code goes here If Err.Number < 0 Then Err.Clear End If On Error GoTo 0 -- Hmm...they have the Internet on COMPUTERS now! "sungen99" wrote: Is it possible to turn off errors in macros??? I want to save a file to a thumb drive but depending on where you are, Office or Home the drive location will be different. Office is x: and Home is f: I think the best way to accomplish what I need to do is to save the file on both locations. When the macro runs it is going to error out on one of the attempts to save but if I can some how turn off that function it will automatically save. This way there is no need to ask the user if he is at home or at work. Again, my programming ability is limited to hacking existing code and my searching the forums has not turned up anything like this. Thanks again for your help with this. It is much appreciated. -- sungen99 ------------------------------------------------------------------------ sungen99's Profile: http://www.excelforum.com/member.php...fo&userid=9144 View this thread: http://www.excelforum.com/showthread...hreadid=505730 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Error GoTo 0 gives VBA back its error handling. Clearing the errors object
ensures that if there WAS an error generated by saving, it isn't flagged once VBA is back in control. -- Hmm...they have the Internet on COMPUTERS now! "Sloth" wrote: what is the purpose of the bottom 4 lines? "MDW" wrote: This will work, but it will quash ALL errors ("Not enough space to save", "Your computer is on fire", etc.), so use it with extreme caution. On Error Resume Next ' You save code goes here If Err.Number < 0 Then Err.Clear End If On Error GoTo 0 -- Hmm...they have the Internet on COMPUTERS now! "sungen99" wrote: Is it possible to turn off errors in macros??? I want to save a file to a thumb drive but depending on where you are, Office or Home the drive location will be different. Office is x: and Home is f: I think the best way to accomplish what I need to do is to save the file on both locations. When the macro runs it is going to error out on one of the attempts to save but if I can some how turn off that function it will automatically save. This way there is no need to ask the user if he is at home or at work. Again, my programming ability is limited to hacking existing code and my searching the forums has not turned up anything like this. Thanks again for your help with this. It is much appreciated. -- sungen99 ------------------------------------------------------------------------ sungen99's Profile: http://www.excelforum.com/member.php...fo&userid=9144 View this thread: http://www.excelforum.com/showthread...hreadid=505730 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macros to Pull Errors to Top of the Page | Excel Worksheet Functions | |||
Want to run two macros without errors | Excel Discussion (Misc queries) | |||
Errors in named formulas after running macros | Excel Programming | |||
macros errors | Excel Worksheet Functions | |||
how do I turn of the macros | Excel Discussion (Misc queries) |