Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Save using Macro but test to see if an error appears on spreadshee

I have tests on spreadsheet to see if data is missing and want to save the
spreadsheet using a macro, but first test to see if there is an error
message. I am only a basic user of macro's and use them through record. I
have found out how to put a message box on screen, but want the box to appear
when there is an error, but to save when there are no errors.
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 94
Default Save using Macro but test to see if an error appears on spreadshee

You'll need to create a variable to store an error, I'd suggest a Boolean.

--------
Dim blnError as Boolean

blnError = False
--------


Then when your code finds an 'error' add this line straight after

--------
blnError = True
--------

Then at the end of your code, before the save happens, try this

--------
If Not blnError then
{Enter your line of code which saves the data}
Else
MsgBox "Error found, workbook not saved!"
end if
--------

Hope this both makes sense and helps.

HTH.

"jfaz" wrote:

I have tests on spreadsheet to see if data is missing and want to save the
spreadsheet using a macro, but first test to see if there is an error
message. I am only a basic user of macro's and use them through record. I
have found out how to put a message box on screen, but want the box to appear
when there is an error, but to save when there are no errors.

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
Using Macro to Save Copy of File to New Location Chris Z Excel Discussion (Misc queries) 3 September 12th 06 11:26 PM
Macro Save As John Excel Discussion (Misc queries) 1 June 1st 06 12:44 PM
Macro to create "path" for save Chris Excel Discussion (Misc queries) 4 March 15th 06 10:38 AM
Save a Macro ducttape Excel Discussion (Misc queries) 3 February 20th 06 04:46 PM
How to stop getting the file save box when running a macro Pank Mehta Excel Discussion (Misc queries) 1 March 29th 05 04:05 PM


All times are GMT +1. The time now is 05:04 PM.

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

About Us

"It's about Microsoft Excel"