Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 26
Default Range CopyPicture()

Hi,

I'm working on an app which i need to copy a range of cells which is
programatically generated using the Excel object model. I want to be able to
select the output range which consists of charts and cells making up a table.
I'm using the CopyPicture() method of Range which i had woring once to copy
the charts and cells combination into word. Having run this again it won't
pull across the charts now. The areas where these are meant to go are just
blank.

Has anyone experienced this before and could maybe give me some information
on how to resolve this. I know it can be done as it worked once. I'm
wondering if the slight adjustment made to the chart upon which the output
charts are based has upset something. Copying manually seems to work but the
formatting is skewed somewhat, hence the requirement of the picture to be
used.

Any help will be greatly appreciated.

G
  #2   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Range CopyPicture()

Did you happen to use any code for this? If so, why not paste it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"GS80" wrote in message
...
Hi,

I'm working on an app which i need to copy a range of cells which is
programatically generated using the Excel object model. I want to be able
to
select the output range which consists of charts and cells making up a
table.
I'm using the CopyPicture() method of Range which i had woring once to
copy
the charts and cells combination into word. Having run this again it won't
pull across the charts now. The areas where these are meant to go are just
blank.

Has anyone experienced this before and could maybe give me some
information
on how to resolve this. I know it can be done as it worked once. I'm
wondering if the slight adjustment made to the chart upon which the output
charts are based has upset something. Copying manually seems to work but
the
formatting is skewed somewhat, hence the requirement of the picture to be
used.

Any help will be greatly appreciated.

G



  #3   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 26
Default Range CopyPicture()

I did, and fair point about including the code.

I do however think that i have just resolved my problem. It appears that i
have to call the activate() method on the Worksheet containing the items I
need to copy. Without this method all i get is the cells and the cell data
returned.

Code will be forthcoming with any other posts.

Thanks,

G

"Jon Peltier" wrote:

Did you happen to use any code for this? If so, why not paste it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"GS80" wrote in message
...
Hi,

I'm working on an app which i need to copy a range of cells which is
programatically generated using the Excel object model. I want to be able
to
select the output range which consists of charts and cells making up a
table.
I'm using the CopyPicture() method of Range which i had woring once to
copy
the charts and cells combination into word. Having run this again it won't
pull across the charts now. The areas where these are meant to go are just
blank.

Has anyone experienced this before and could maybe give me some
information
on how to resolve this. I know it can be done as it worked once. I'm
wondering if the slight adjustment made to the chart upon which the output
charts are based has upset something. Copying manually seems to work but
the
formatting is skewed somewhat, hence the requirement of the picture to be
used.

Any help will be greatly appreciated.

G




  #4   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 26
Default Range CopyPicture()

Ok. Working with another data range now with the same idea, in this case its
only the last graph of 4 that doesn't appear. Strangely, if i ope the file
and modify a cell in the range to be copied, when running the app again to
copy the range, the top 2 graphs disappear. The code i use to copy is below:

ws = (Worksheet)wb.Worksheets["wsPres"];
ws.Activate();
testRange = ws.get_Range("A1:H44", missing);
testRange.CopyPicture(XlPictureAppearance.xlScreen ,
XlCopyPictureFormat.xlPicture);
myDoc.Select();
wordApp.Selection.Paste();

The Excel and Word documents are opened prior to this code.
Hopefully the above code is enough to highlight what i maybe doing wrong. If
anything else is required let me know.

Thanks,

G

"Jon Peltier" wrote:

Did you happen to use any code for this? If so, why not paste it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"GS80" wrote in message
...
Hi,

I'm working on an app which i need to copy a range of cells which is
programatically generated using the Excel object model. I want to be able
to
select the output range which consists of charts and cells making up a
table.
I'm using the CopyPicture() method of Range which i had woring once to
copy
the charts and cells combination into word. Having run this again it won't
pull across the charts now. The areas where these are meant to go are just
blank.

Has anyone experienced this before and could maybe give me some
information
on how to resolve this. I know it can be done as it worked once. I'm
wondering if the slight adjustment made to the chart upon which the output
charts are based has upset something. Copying manually seems to work but
the
formatting is skewed somewhat, hence the requirement of the picture to be
used.

Any help will be greatly appreciated.

G




  #5   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 26
Default Range CopyPicture()

In addition to my last post. It seems to be down to what is visible on the
page when the document is saved. If I open the Excel document and scroll down
so only the 2 lowest graphs are visible, this appears to be all that is
displayed on the output. ERegardless of position, all cell data is copied as
expected. Not sure if this is of any more help.

G

"Jon Peltier" wrote:

Did you happen to use any code for this? If so, why not paste it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"GS80" wrote in message
...
Hi,

I'm working on an app which i need to copy a range of cells which is
programatically generated using the Excel object model. I want to be able
to
select the output range which consists of charts and cells making up a
table.
I'm using the CopyPicture() method of Range which i had woring once to
copy
the charts and cells combination into word. Having run this again it won't
pull across the charts now. The areas where these are meant to go are just
blank.

Has anyone experienced this before and could maybe give me some
information
on how to resolve this. I know it can be done as it worked once. I'm
wondering if the slight adjustment made to the chart upon which the output
charts are based has upset something. Copying manually seems to work but
the
formatting is skewed somewhat, hence the requirement of the picture to be
used.

Any help will be greatly appreciated.

G






  #6   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Range CopyPicture()

If you reference your objects appropriately, you don't need to activate or
select anything. This test code gave me a picture of the appropriate region
in metafile format, even if another range was selected or another sheet was
active:

worksheets("Project Input (4)").range("F242:L262").copypicture
Appearance:=xlScreen, Format:=xlPicture

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"GS80" wrote in message
...
I did, and fair point about including the code.

I do however think that i have just resolved my problem. It appears that i
have to call the activate() method on the Worksheet containing the items I
need to copy. Without this method all i get is the cells and the cell data
returned.

Code will be forthcoming with any other posts.

Thanks,

G

"Jon Peltier" wrote:

Did you happen to use any code for this? If so, why not paste it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"GS80" wrote in message
...
Hi,

I'm working on an app which i need to copy a range of cells which is
programatically generated using the Excel object model. I want to be
able
to
select the output range which consists of charts and cells making up a
table.
I'm using the CopyPicture() method of Range which i had woring once to
copy
the charts and cells combination into word. Having run this again it
won't
pull across the charts now. The areas where these are meant to go are
just
blank.

Has anyone experienced this before and could maybe give me some
information
on how to resolve this. I know it can be done as it worked once. I'm
wondering if the slight adjustment made to the chart upon which the
output
charts are based has upset something. Copying manually seems to work
but
the
formatting is skewed somewhat, hence the requirement of the picture to
be
used.

Any help will be greatly appreciated.

G






  #7   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 26
Default Range CopyPicture()

Think i'll go back and check out my code. I got a solution by selecting the
usedrange() method of the current worksheet. I'll let you know how it goes by
looking at the way i reference my objects.

Thanks for your patience.

G

"Jon Peltier" wrote:

If you reference your objects appropriately, you don't need to activate or
select anything. This test code gave me a picture of the appropriate region
in metafile format, even if another range was selected or another sheet was
active:

worksheets("Project Input (4)").range("F242:L262").copypicture
Appearance:=xlScreen, Format:=xlPicture

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"GS80" wrote in message
...
I did, and fair point about including the code.

I do however think that i have just resolved my problem. It appears that i
have to call the activate() method on the Worksheet containing the items I
need to copy. Without this method all i get is the cells and the cell data
returned.

Code will be forthcoming with any other posts.

Thanks,

G

"Jon Peltier" wrote:

Did you happen to use any code for this? If so, why not paste it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"GS80" wrote in message
...
Hi,

I'm working on an app which i need to copy a range of cells which is
programatically generated using the Excel object model. I want to be
able
to
select the output range which consists of charts and cells making up a
table.
I'm using the CopyPicture() method of Range which i had woring once to
copy
the charts and cells combination into word. Having run this again it
won't
pull across the charts now. The areas where these are meant to go are
just
blank.

Has anyone experienced this before and could maybe give me some
information
on how to resolve this. I know it can be done as it worked once. I'm
wondering if the slight adjustment made to the chart upon which the
output
charts are based has upset something. Copying manually seems to work
but
the
formatting is skewed somewhat, hence the requirement of the picture to
be
used.

Any help will be greatly appreciated.

G






  #8   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 6,582
Default Range CopyPicture()

My code works fine even if the range to copy is scrolled off screen. I'm
using VBA, though, and I notice you're using that wacky dot net stuff. I
don't know whether there's any issue related to that.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"GS80" wrote in message
...
In addition to my last post. It seems to be down to what is visible on the
page when the document is saved. If I open the Excel document and scroll
down
so only the 2 lowest graphs are visible, this appears to be all that is
displayed on the output. ERegardless of position, all cell data is copied
as
expected. Not sure if this is of any more help.

G

"Jon Peltier" wrote:

Did you happen to use any code for this? If so, why not paste it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"GS80" wrote in message
...
Hi,

I'm working on an app which i need to copy a range of cells which is
programatically generated using the Excel object model. I want to be
able
to
select the output range which consists of charts and cells making up a
table.
I'm using the CopyPicture() method of Range which i had woring once to
copy
the charts and cells combination into word. Having run this again it
won't
pull across the charts now. The areas where these are meant to go are
just
blank.

Has anyone experienced this before and could maybe give me some
information
on how to resolve this. I know it can be done as it worked once. I'm
wondering if the slight adjustment made to the chart upon which the
output
charts are based has upset something. Copying manually seems to work
but
the
formatting is skewed somewhat, hence the requirement of the picture to
be
used.

Any help will be greatly appreciated.

G






  #9   Report Post  
Posted to microsoft.public.excel.charting
external usenet poster
 
Posts: 26
Default Range CopyPicture()

I'm thinking there may well be. There is a lot more casting of objects
required within C# than any VBA code i've seen, I've also noticed that there
are a number of methods that differ from the VBA equivalent. Unfortunately my
App has to be in C#. As i said, if i select the Usedrange() on the page i'm
interested in, i can select all appropriate data as a picture. This resolves
my issue just now but it does raise some concerns over the potential for
running into other issues like this.

Thanks for your help.

G

"Jon Peltier" wrote:

My code works fine even if the range to copy is scrolled off screen. I'm
using VBA, though, and I notice you're using that wacky dot net stuff. I
don't know whether there's any issue related to that.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"GS80" wrote in message
...
In addition to my last post. It seems to be down to what is visible on the
page when the document is saved. If I open the Excel document and scroll
down
so only the 2 lowest graphs are visible, this appears to be all that is
displayed on the output. ERegardless of position, all cell data is copied
as
expected. Not sure if this is of any more help.

G

"Jon Peltier" wrote:

Did you happen to use any code for this? If so, why not paste it.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"GS80" wrote in message
...
Hi,

I'm working on an app which i need to copy a range of cells which is
programatically generated using the Excel object model. I want to be
able
to
select the output range which consists of charts and cells making up a
table.
I'm using the CopyPicture() method of Range which i had woring once to
copy
the charts and cells combination into word. Having run this again it
won't
pull across the charts now. The areas where these are meant to go are
just
blank.

Has anyone experienced this before and could maybe give me some
information
on how to resolve this. I know it can be done as it worked once. I'm
wondering if the slight adjustment made to the chart upon which the
output
charts are based has upset something. Copying manually seems to work
but
the
formatting is skewed somewhat, hence the requirement of the picture to
be
used.

Any help will be greatly appreciated.

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
Control size of chart - CopyPicture Fredrik E. Nilsen Charts and Charting in Excel 0 April 20th 07 05:51 PM
Excel Addin:Setting the range to the Excel.Range object range prop Rp007 Excel Worksheet Functions 5 November 24th 06 04:30 PM
formula to sort a range so that it matches the exact rows of a column that is outside that range? steveo Excel Discussion (Misc queries) 1 June 18th 06 02:05 AM
How to count dates within a certain range in a column with mutiple date range entries Krisjhn Excel Worksheet Functions 2 September 1st 05 01:59 PM
CopyPicture ????? Paul Smith Charts and Charting in Excel 3 February 15th 05 10:49 PM


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