Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default Dave Peterson

Hi
I try to use the script you help me with to copy pictures from one sheet to
another
this one:
Sub testme()
Dim FWks As Worksheet
Dim TWks As Worksheet
Dim myPict As Picture

Set FWks = Worksheets("billeder")
Set TWks = Worksheets("print")

For Each myPict In FWks.Pictures
myPict.copy
TWks.Range(myPict.TopLeftCell.Address(0, 0)).PasteSpecial _
Paste:=xlPasteAll
Next myPict

End Sub
But get an error by excel there write
"excel canoot paste the data"

CAn you or someone else help me?

regards

Alvin

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Dave Peterson

See if this works:

Sub testme1()
Dim FWks As Worksheet
Dim TWks As Worksheet
Dim myPict As Object

Set FWks = Worksheets("billeder")
Set TWks = Worksheets("print")

TWks.Select
For Each myPict In FWks.Pictures
If TypeName(myPict) = "Picture" Then
myPict.Copy
TWks.Range(myPict.TopLeftCell.Address(0, 0)).Select
TWks.Paste
End If
Next myPict


End Sub

--
Regards,
Tom Ogilvy


"Alvin Hansen" wrote in message
...
Hi
I try to use the script you help me with to copy pictures from one sheet

to
another
this one:
Sub testme()
Dim FWks As Worksheet
Dim TWks As Worksheet
Dim myPict As Picture

Set FWks = Worksheets("billeder")
Set TWks = Worksheets("print")

For Each myPict In FWks.Pictures
myPict.copy
TWks.Range(myPict.TopLeftCell.Address(0, 0)).PasteSpecial _
Paste:=xlPasteAll
Next myPict

End Sub
But get an error by excel there write
"excel canoot paste the data"

CAn you or someone else help me?

regards

Alvin



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Dave Peterson

Good chance your pictures are not typed as picture.

Put this code in the module

Sub ShowTypename()
msgbox typename(selection)
End Sub

then select one of your pictures and run the macro.

Did it say Picture

If not then try changing this line
If TypeName(myPict) = "Picture" Then

to whatever it said.

--
Regards,
Tom Ogilvy

"Alvin Hansen" wrote in message
...
Hi Tom
Well nothing happens now.

Alvin


"Tom Ogilvy" skrev:

See if this works:

Sub testme1()
Dim FWks As Worksheet
Dim TWks As Worksheet
Dim myPict As Object

Set FWks = Worksheets("billeder")
Set TWks = Worksheets("print")

TWks.Select
For Each myPict In FWks.Pictures
If TypeName(myPict) = "Picture" Then
myPict.Copy
TWks.Range(myPict.TopLeftCell.Address(0, 0)).Select
TWks.Paste
End If
Next myPict


End Sub

--
Regards,
Tom Ogilvy


"Alvin Hansen" wrote in message
...
Hi
I try to use the script you help me with to copy pictures from one

sheet
to
another
this one:
Sub testme()
Dim FWks As Worksheet
Dim TWks As Worksheet
Dim myPict As Picture

Set FWks = Worksheets("billeder")
Set TWks = Worksheets("print")

For Each myPict In FWks.Pictures
myPict.copy
TWks.Range(myPict.TopLeftCell.Address(0, 0)).PasteSpecial _
Paste:=xlPasteAll
Next myPict

End Sub
But get an error by excel there write
"excel canoot paste the data"

CAn you or someone else help me?

regards

Alvin






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 209
Default Dave Peterson

Sorry sorry sorry to Tom and You
It's because my name on the pictures was
picture 1 picture 2 ans so on
It's working with
picture1 picture2 ans so on

Thanks

Alvin


"Alvin Hansen" skrev:

Hi
I try to use the script you help me with to copy pictures from one sheet to
another
this one:
Sub testme()
Dim FWks As Worksheet
Dim TWks As Worksheet
Dim myPict As Picture

Set FWks = Worksheets("billeder")
Set TWks = Worksheets("print")

For Each myPict In FWks.Pictures
myPict.copy
TWks.Range(myPict.TopLeftCell.Address(0, 0)).PasteSpecial _
Paste:=xlPasteAll
Next myPict

End Sub
But get an error by excel there write
"excel canoot paste the data"

CAn you or someone else help me?

regards

Alvin

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Dave Peterson

Glad you got it working, but neither versions of the code depended on the names
of the pictures.



Alvin Hansen wrote:

Sorry sorry sorry to Tom and You
It's because my name on the pictures was
picture 1 picture 2 ans so on
It's working with
picture1 picture2 ans so on

Thanks

Alvin

"Alvin Hansen" skrev:

Hi
I try to use the script you help me with to copy pictures from one sheet to
another
this one:
Sub testme()
Dim FWks As Worksheet
Dim TWks As Worksheet
Dim myPict As Picture

Set FWks = Worksheets("billeder")
Set TWks = Worksheets("print")

For Each myPict In FWks.Pictures
myPict.copy
TWks.Range(myPict.TopLeftCell.Address(0, 0)).PasteSpecial _
Paste:=xlPasteAll
Next myPict

End Sub
But get an error by excel there write
"excel canoot paste the data"

CAn you or someone else help me?

regards

Alvin


--

Dave Peterson
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
Dave Peterson...HELP!!!! Lynda Excel Discussion (Misc queries) 2 October 1st 08 01:47 PM
Dave Peterson Bob Myers Excel Worksheet Functions 2 January 9th 08 03:33 PM
Dave Peterson Rich_Patterson Excel Discussion (Misc queries) 2 January 26th 07 08:56 PM
Dave Peterson joelbeveridge Excel Discussion (Misc queries) 1 August 4th 06 02:55 AM
Dave Peterson atxcomputers Excel Discussion (Misc queries) 12 September 28th 05 06:17 PM


All times are GMT +1. The time now is 11:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"