Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How to Delete Excel Sheet without Warning - MFC

Hi ~
I am automating Excel by embedding it in my MFC dialog. I need to
delete an excel chart and I have tried to use the app function
SetDisplayAlerts to FALSE. However, this doesn't work for me. I get
an error message "Unable to Set DisplayAlerts property of Application
Class." I have searched online for hours, and all I have found is that
this may not be available when embedding excel into your program.

So my question is, any ideas on getting this to work, or hiding an
error message? Is there an alternative way to delete a worksheet so
that it won't give an error message?
Please help!!
Jen

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to Delete Excel Sheet without Warning - MFC

That is the only way I know to suppress the prompt.

Why not clear and hide the sheet. Always using the same sheet if this is a
recurring requirement (unhide it).

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Hi ~
I am automating Excel by embedding it in my MFC dialog. I need to
delete an excel chart and I have tried to use the app function
SetDisplayAlerts to FALSE. However, this doesn't work for me. I get
an error message "Unable to Set DisplayAlerts property of Application
Class." I have searched online for hours, and all I have found is that
this may not be available when embedding excel into your program.

So my question is, any ideas on getting this to work, or hiding an
error message? Is there an alternative way to delete a worksheet so
that it won't give an error message?
Please help!!
Jen



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How to Delete Excel Sheet without Warning - MFC

I definitely could do it that way, however that causes another problem.

I use CopyFromRecordset to set the data in the spreadsheet with data
from my Access database. The sheet I am deleting is actually a chart
that uses data from a worksheet. If I clear it, and then try
CopyFromRecordset, that function crashes. My only thought is that it
is crashing because the chart has it's source data as the data I am
hiding/setting.

I thought that just deleting the sheet with the chart and then adding
the chart again would be easier. However because of the warning
message, this won't work!

So I think your recommendation is the way I need to go...Any tips on
getting around the crash in CopyFromRecordset?
Thanks!!
Jen

Tom Ogilvy wrote:
That is the only way I know to suppress the prompt.

Why not clear and hide the sheet. Always using the same sheet if this is a
recurring requirement (unhide it).

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Hi ~
I am automating Excel by embedding it in my MFC dialog. I need to
delete an excel chart and I have tried to use the app function
SetDisplayAlerts to FALSE. However, this doesn't work for me. I get
an error message "Unable to Set DisplayAlerts property of Application
Class." I have searched online for hours, and all I have found is that
this may not be available when embedding excel into your program.

So my question is, any ideas on getting this to work, or hiding an
error message? Is there an alternative way to delete a worksheet so
that it won't give an error message?
Please help!!
Jen


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to Delete Excel Sheet without Warning - MFC

If that is in fact the cause, then

Try using the equivalent of

Activesheet.Cells.ClearContents

to clear the cells, rather than Delete.

or delete the series in the chart before deleting the cells, then add them
back in after adding the new data.



--
Regards,
Tom Ogilvy


wrote in message
ups.com...
I definitely could do it that way, however that causes another problem.

I use CopyFromRecordset to set the data in the spreadsheet with data
from my Access database. The sheet I am deleting is actually a chart
that uses data from a worksheet. If I clear it, and then try
CopyFromRecordset, that function crashes. My only thought is that it
is crashing because the chart has it's source data as the data I am
hiding/setting.

I thought that just deleting the sheet with the chart and then adding
the chart again would be easier. However because of the warning
message, this won't work!

So I think your recommendation is the way I need to go...Any tips on
getting around the crash in CopyFromRecordset?
Thanks!!
Jen

Tom Ogilvy wrote:
That is the only way I know to suppress the prompt.

Why not clear and hide the sheet. Always using the same sheet if this is
a
recurring requirement (unhide it).

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Hi ~
I am automating Excel by embedding it in my MFC dialog. I need to
delete an excel chart and I have tried to use the app function
SetDisplayAlerts to FALSE. However, this doesn't work for me. I get
an error message "Unable to Set DisplayAlerts property of Application
Class." I have searched online for hours, and all I have found is that
this may not be available when embedding excel into your program.

So my question is, any ideas on getting this to work, or hiding an
error message? Is there an alternative way to delete a worksheet so
that it won't give an error message?
Please help!!
Jen




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to Delete Excel Sheet without Warning - MFC

Or just copy over the old data without deleting or clearing it, then adjust
the series to point to the new data and adjust any residual.

--
Regards,
Tom Ogilvy

wrote in message
ups.com...
I definitely could do it that way, however that causes another problem.

I use CopyFromRecordset to set the data in the spreadsheet with data
from my Access database. The sheet I am deleting is actually a chart
that uses data from a worksheet. If I clear it, and then try
CopyFromRecordset, that function crashes. My only thought is that it
is crashing because the chart has it's source data as the data I am
hiding/setting.

I thought that just deleting the sheet with the chart and then adding
the chart again would be easier. However because of the warning
message, this won't work!

So I think your recommendation is the way I need to go...Any tips on
getting around the crash in CopyFromRecordset?
Thanks!!
Jen

Tom Ogilvy wrote:
That is the only way I know to suppress the prompt.

Why not clear and hide the sheet. Always using the same sheet if this is
a
recurring requirement (unhide it).

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Hi ~
I am automating Excel by embedding it in my MFC dialog. I need to
delete an excel chart and I have tried to use the app function
SetDisplayAlerts to FALSE. However, this doesn't work for me. I get
an error message "Unable to Set DisplayAlerts property of Application
Class." I have searched online for hours, and all I have found is that
this may not be available when embedding excel into your program.

So my question is, any ideas on getting this to work, or hiding an
error message? Is there an alternative way to delete a worksheet so
that it won't give an error message?
Please help!!
Jen






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default How to Delete Excel Sheet without Warning - MFC

Tom,
I tried clearing the cells, and just copying over them, and it crashed
both times. Deleting the series and then adding it back afterwards
works great though!

Thanks for your help...I really appreciate it!!
Jen


Tom Ogilvy wrote:
Or just copy over the old data without deleting or clearing it, then adjust
the series to point to the new data and adjust any residual.

--
Regards,
Tom Ogilvy

wrote in message
ups.com...
I definitely could do it that way, however that causes another problem.

I use CopyFromRecordset to set the data in the spreadsheet with data
from my Access database. The sheet I am deleting is actually a chart
that uses data from a worksheet. If I clear it, and then try
CopyFromRecordset, that function crashes. My only thought is that it
is crashing because the chart has it's source data as the data I am
hiding/setting.

I thought that just deleting the sheet with the chart and then adding
the chart again would be easier. However because of the warning
message, this won't work!

So I think your recommendation is the way I need to go...Any tips on
getting around the crash in CopyFromRecordset?
Thanks!!
Jen

Tom Ogilvy wrote:
That is the only way I know to suppress the prompt.

Why not clear and hide the sheet. Always using the same sheet if this is
a
recurring requirement (unhide it).

--
Regards,
Tom Ogilvy


wrote in message
oups.com...
Hi ~
I am automating Excel by embedding it in my MFC dialog. I need to
delete an excel chart and I have tried to use the app function
SetDisplayAlerts to FALSE. However, this doesn't work for me. I get
an error message "Unable to Set DisplayAlerts property of Application
Class." I have searched online for hours, and all I have found is that
this may not be available when embedding excel into your program.

So my question is, any ideas on getting this to work, or hiding an
error message? Is there an alternative way to delete a worksheet so
that it won't give an error message?
Please help!!
Jen



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
Why security warning still appear after I delete all macros Wei Kai Excel Worksheet Functions 1 February 8th 07 05:51 AM
VBA Bypass Delete Sheet Warning bill_morgan Excel Programming 8 February 28th 06 10:51 PM
What is the VBA code to delete a sheet without warning message? [email protected] Excel Discussion (Misc queries) 2 August 9th 05 04:16 PM
Delete sheet without warning messages Flystar[_17_] Excel Programming 1 May 31st 04 04:51 AM
Warning Statement to Delete Macro John M[_5_] Excel Programming 2 November 25th 03 04:09 PM


All times are GMT +1. The time now is 05:06 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"