Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
CopyPicture only works second time
I have a strange problem with Excel 2003...
I have made a button which copies the charts of the active sheet to the clipboard using the CopyPicture method, but it doesn't work the first time!! The code looks like this: Sub copyGraphs() Dim i As Integer Dim graphs() As Variant Dim test As Variant Dim asRange As Variant Dim numShapes As Integer Dim numAutoShapes As Integer With ActiveSheet.Shapes numShapes = .Count If numShapes 1 Then numAutoShapes = 0 ReDim graphs(1 To numShapes) For i = 1 To numShapes If .Item(i).Type = msoChart Then numAutoShapes = numAutoShapes + 1 grafer(numAutoShapes) = .Item(i).Name End If Next If numAutoShapes 1 Then ReDim Preserve graphs(1 To numAutoShapes) Set asRange = .Range(graphs) asRange.Select Selection.CopyPicture Appearance:=xlScreen, Format:=xlPicture End If End If End With End Sub When I test it, I do the following: 1) I open the workbook, activates a sheet with several Chart objects and push the 'Copy to clipboard' button 2) I start Word and choose Edit - Paste That gives only a small icon instead of the chart objects. 3) In Excel I push the 'Copy to clipboard' button again. 4) In Word I choose Edit - Paste I now get the correct graphs as they are supposed to... What am I doing wrong?? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro that works one time every day | Excel Discussion (Misc queries) | |||
Range CopyPicture() | Charts and Charting in Excel | |||
CopyPicture ????? | Charts and Charting in Excel | |||
CopyPicture ????? | Excel Programming | |||
CopyPicture | Excel Programming |