Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.charting
|
|||
|
|||
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
Posted to microsoft.public.excel.charting
|
|||
|
|||
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
Posted to microsoft.public.excel.charting
|
|||
|
|||
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
Posted to microsoft.public.excel.charting
|
|||
|
|||
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
Posted to microsoft.public.excel.charting
|
|||
|
|||
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
Posted to microsoft.public.excel.charting
|
|||
|
|||
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
Posted to microsoft.public.excel.charting
|
|||
|
|||
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
Posted to microsoft.public.excel.charting
|
|||
|
|||
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
Posted to microsoft.public.excel.charting
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Control size of chart - CopyPicture | Charts and Charting in Excel | |||
Excel Addin:Setting the range to the Excel.Range object range prop | Excel Worksheet Functions | |||
formula to sort a range so that it matches the exact rows of a column that is outside that range? | Excel Discussion (Misc queries) | |||
How to count dates within a certain range in a column with mutiple date range entries | Excel Worksheet Functions | |||
CopyPicture ????? | Charts and Charting in Excel |