LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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
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
macro that works one time every day Spiros Excel Discussion (Misc queries) 2 September 19th 08 12:00 PM
Range CopyPicture() GS80 Charts and Charting in Excel 8 January 30th 08 03:41 PM
CopyPicture ????? Paul Smith Charts and Charting in Excel 3 February 15th 05 10:49 PM
CopyPicture ????? Paul Smith[_3_] Excel Programming 3 February 15th 05 10:49 PM
CopyPicture Remi Excel Programming 7 November 12th 03 05:25 PM


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