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
_______
> Hi,
>
[quoted text clipped - 21 lines]
>
> G
GS80 - 30 Jan 2008 13:45 GMT
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
> Did you happen to use any code for this? If so, why not paste it.
>
[quoted text clipped - 30 lines]
> >
> > G
Jon Peltier - 30 Jan 2008 15:19 GMT
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
_______
>I did, and fair point about including the code.
>
[quoted text clipped - 49 lines]
>> >
>> > G
GS80 - 30 Jan 2008 15:31 GMT
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
> 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
[quoted text clipped - 64 lines]
> >> >
> >> > G
GS80 - 30 Jan 2008 15:11 GMT
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
> Did you happen to use any code for this? If so, why not paste it.
>
[quoted text clipped - 30 lines]
> >
> > G
GS80 - 30 Jan 2008 15:17 GMT
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
> Did you happen to use any code for this? If so, why not paste it.
>
[quoted text clipped - 30 lines]
> >
> > G
Jon Peltier - 30 Jan 2008 15:32 GMT
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
_______
> 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
[quoted text clipped - 46 lines]
>> >
>> > G
GS80 - 30 Jan 2008 15:41 GMT
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
> 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
[quoted text clipped - 57 lines]
> >> >
> >> > G