Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Is it possible to turn off errors in macros???


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Is it possible to turn off errors in macros???

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   Report Post  
Posted to microsoft.public.excel.programming
MDW MDW is offline
external usenet poster
 
Posts: 117
Default Is it possible to turn off errors in macros???

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default Is it possible to turn off errors in macros???

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   Report Post  
Posted to microsoft.public.excel.programming
MDW MDW is offline
external usenet poster
 
Posts: 117
Default Is it possible to turn off errors in macros???

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros to Pull Errors to Top of the Page Daren Excel Worksheet Functions 3 August 2nd 07 06:28 PM
Want to run two macros without errors daidipya Excel Discussion (Misc queries) 3 June 2nd 06 08:51 AM
Errors in named formulas after running macros ton t Excel Programming 0 May 11th 05 01:29 PM
macros errors Natalie Excel Worksheet Functions 5 March 14th 05 02:27 PM
how do I turn of the macros jack Excel Discussion (Misc queries) 2 January 13th 05 03:12 AM


All times are GMT +1. The time now is 11:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"