Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default Confrimation of copy paste operation

Hi,

In my application (C#, Office 2007), i am attempting to copy a range of
cells containing data to a range on another worksheet. Upon copying the range
I then copy a chart into a specific area on the second worksheet. The chart
is resized and set up to represent a datapoint per row of data so the chart.

Occasionally (and i mean occasionally, i cannot replicate the problem 100%
of the time) the chart does not get copied to the second worksheet. I do this
a number of times for various different table ranges. Sometimes there will be
a number of these charts copied to the same output worksheet and i have
encountered this issue where by only some of the charts copy and others don't.

I generally use the following code to do the copy paste

_chObj = (ChartObject)_excelDataWS.ChartObjects("ChartName" );
_chObj.Copy();
_excelPresentationWS.Paste(_presTopLeftRange), paramMissing);

I have a couple of questions on this problem.

1) Is there a benefit to using the following copy command?:
_chObj.CopyPicture(XlPictureAppearance.xlScreen,
XlCopyPictureFormat.xlPicture);

2) Is there any way to confirm that a copy/paste operation has succeeded and
if not then to retry it?

I'm really having no joy in diagnosing why this is happening. I get no
exceptions thrown when the charts do not appear.

Any help is greatfully recieved.

Thanks in advance,

G
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Confrimation of copy paste operation

I believe a chart will always copy. I suspect the _chObj may be empty
(null). I would set _chObj to Null before you assign the chart, then test if
it is still null afterwards before you do the copy.

"GS80" wrote:

Hi,

In my application (C#, Office 2007), i am attempting to copy a range of
cells containing data to a range on another worksheet. Upon copying the range
I then copy a chart into a specific area on the second worksheet. The chart
is resized and set up to represent a datapoint per row of data so the chart.

Occasionally (and i mean occasionally, i cannot replicate the problem 100%
of the time) the chart does not get copied to the second worksheet. I do this
a number of times for various different table ranges. Sometimes there will be
a number of these charts copied to the same output worksheet and i have
encountered this issue where by only some of the charts copy and others don't.

I generally use the following code to do the copy paste

_chObj = (ChartObject)_excelDataWS.ChartObjects("ChartName" );
_chObj.Copy();
_excelPresentationWS.Paste(_presTopLeftRange), paramMissing);

I have a couple of questions on this problem.

1) Is there a benefit to using the following copy command?:
_chObj.CopyPicture(XlPictureAppearance.xlScreen,
XlCopyPictureFormat.xlPicture);

2) Is there any way to confirm that a copy/paste operation has succeeded and
if not then to retry it?

I'm really having no joy in diagnosing why this is happening. I get no
exceptions thrown when the charts do not appear.

Any help is greatfully recieved.

Thanks in advance,

G

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
"ignoring" hidden cells in a copy/paste operation gvm Excel Discussion (Misc queries) 2 March 22nd 07 10:38 PM
Change cut/paste operation to cut/insert operation Don Guillett Excel Programming 0 January 17th 07 03:23 PM
Use of Paste Special - Operation Avadivelan TCS Excel Worksheet Functions 10 October 12th 06 02:33 PM
Curious operation of Paste Fred Smith Excel Discussion (Misc queries) 1 March 24th 06 12:02 PM
What of these commands ruin my copy - paste operation between workbooks? No Name Excel Programming 2 May 4th 04 02:00 AM


All times are GMT +1. The time now is 07:52 AM.

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"