Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default On Error Resume Next

I want to switch backgrounds as an indication to the user
of unsaved changes. I want it to skip it if it is going
to cause a run time error so I use "on error resume next",
but it still errors when there is not enough memory. How
do I make it really skip the setbackgroundpicture function
if there is not enough memory?

On Error Resume Next
ThisWorkbook.Worksheets("Data").SetBackgroundPictu re
ThisWorkbook.Path & _
Application.PathSeparator & "QPIBackground.jpg"

TIA
Mike
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default On Error Resume Next

Application.MemoryFree returns the number of bytes available to Excel to use.
You need to determine how many bytes are required for your operation and
compare this to what is available and the abandon or execute your operation.

"Mike Archer" wrote:

I want to switch backgrounds as an indication to the user
of unsaved changes. I want it to skip it if it is going
to cause a run time error so I use "on error resume next",
but it still errors when there is not enough memory. How
do I make it really skip the setbackgroundpicture function
if there is not enough memory?

On Error Resume Next
ThisWorkbook.Worksheets("Data").SetBackgroundPictu re
ThisWorkbook.Path & _
Application.PathSeparator & "QPIBackground.jpg"

TIA
Mike

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default On Error Resume Next

That sounds good. How do I determine how many bytes are
required for the operation?
Mike

-----Original Message-----
Application.MemoryFree returns the number of bytes

available to Excel to use.
You need to determine how many bytes are required for

your operation and
compare this to what is available and the abandon or

execute your operation.

"Mike Archer" wrote:

I want to switch backgrounds as an indication to the

user
of unsaved changes. I want it to skip it if it is

going
to cause a run time error so I use "on error resume

next",
but it still errors when there is not enough memory.

How
do I make it really skip the setbackgroundpicture

function
if there is not enough memory?

On Error Resume Next
ThisWorkbook.Worksheets("Data").SetBackgroundPictu re
ThisWorkbook.Path & _
Application.PathSeparator & "QPIBackground.jpg"

TIA
Mike

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default On Error Resume Next

I am not sure I know the answer or how it coould be determined. I would guess
as follows:

When the operation fails, Ctrl + Break and then query available memory. Now
you know how much is NOT enough. Let this be A. I would add something to
this, say 8K, and assume that the operation is not possible unless A bytes +
8K is available.

You'll need to fine tune this with trial and error.


"Mike Archer" wrote:

That sounds good. How do I determine how many bytes are
required for the operation?
Mike

-----Original Message-----
Application.MemoryFree returns the number of bytes

available to Excel to use.
You need to determine how many bytes are required for

your operation and
compare this to what is available and the abandon or

execute your operation.

"Mike Archer" wrote:

I want to switch backgrounds as an indication to the

user
of unsaved changes. I want it to skip it if it is

going
to cause a run time error so I use "on error resume

next",
but it still errors when there is not enough memory.

How
do I make it really skip the setbackgroundpicture

function
if there is not enough memory?

On Error Resume Next
ThisWorkbook.Worksheets("Data").SetBackgroundPictu re
ThisWorkbook.Path & _
Application.PathSeparator & "QPIBackground.jpg"

TIA
Mike

.


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
On Error Resume Next problem Jim May Excel Discussion (Misc queries) 14 November 2nd 07 12:27 PM
On Error Resume Next Jim Sharrock Excel Programming 2 May 13th 04 03:12 PM
ON ERROR RESUME NEXT D.S.[_3_] Excel Programming 7 December 1st 03 09:40 AM
On Error Resume Next D.S.[_3_] Excel Programming 1 November 28th 03 04:52 PM
On Error Resume Next Mike[_58_] Excel Programming 3 November 23rd 03 05:09 PM


All times are GMT +1. The time now is 04:30 AM.

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"