PC Review


Reply
Thread Tools Rate Thread

Copy several photos in a macro

 
 
=?Utf-8?B?R2V0IGEgZmlsZSBuYW1lIGluc2lkZSBhIG1hY3Jv
Guest
Posts: n/a
 
      16th Mar 2007
Hi everyone:

I have a worksheet with 4 pictures on it, I need to copy this pictures in
the same worsheet but in a diferent location, I need to make the picture name
generic.
I want to make the following macro to work with any picture name:

Sub FotoCopy()
'
' FotoCopy Macro
' Macro recorded 3/16/2007 by ER
'
' Keyboard Shortcut: Ctrl+d
'
ActiveSheet.Shapes("Picture 339").Select
Selection.Copy
ActiveSheet.Shapes("Picture 253").Select
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft 225.75
Selection.ShapeRange.IncrementTop -12#
ActiveSheet.Shapes("Picture 335").Select
Selection.Copy
ActiveSheet.Shapes("Picture 261").Select
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft 226.5
Selection.ShapeRange.IncrementTop -12#
ActiveWindow.ScrollRow = 4
ActiveWindow.ScrollRow = 5
ActiveWindow.ScrollRow = 6
ActiveWindow.ScrollRow = 7
ActiveWindow.ScrollRow = 8
ActiveWindow.ScrollRow = 9
ActiveWindow.ScrollRow = 10
ActiveWindow.ScrollRow = 11
ActiveSheet.Shapes("Picture 336").Select
Selection.Copy
ActiveSheet.Shapes("Picture 271").Select
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft 226.5
Selection.ShapeRange.IncrementTop -12#
ActiveWindow.ScrollRow = 12
ActiveWindow.ScrollRow = 13
ActiveWindow.ScrollRow = 14
ActiveWindow.ScrollRow = 15
ActiveWindow.ScrollRow = 16
ActiveWindow.ScrollRow = 18
ActiveWindow.ScrollRow = 19
ActiveWindow.ScrollRow = 20
ActiveSheet.Shapes("Picture 337").Select
Selection.Copy
ActiveSheet.Shapes("Picture 281").Select
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft 226.5
Selection.ShapeRange.IncrementTop -13.5
End Sub

Thank you for you help
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      17th Mar 2007
Learn Macro put a lot of code that is unecessary. this code is much simplier
than original code. You may want to adjust these two lines

where 1st picture is located, change as required
ScrollCount = 4

Spacing between picture is 10, change as required
ScrollCount = ScrollCount + 10 the


Sub FotoCopy()
'
' FotoCopy Macro
' Macro recorded 3/16/2007 by ER
'
' Keyboard Shortcut: Ctrl+d
'
ScrollCount = 4
For Each MyPicture In ActiveSheet.Shapes
ActiveWindow.ScrollRow = ScrollCount
ActiveSheet.Shapes(MyPicture.Name).Select
Selection.Copy
ActiveSheet.Paste
Selection.ShapeRange.IncrementLeft 225.75
Selection.ShapeRange.IncrementTop -12#
ScrollCount = ScrollCount + 10
Next MyPicture
End Sub


"Get a file name inside a macro" wrote:

> Hi everyone:
>
> I have a worksheet with 4 pictures on it, I need to copy this pictures in
> the same worsheet but in a diferent location, I need to make the picture name
> generic.
> I want to make the following macro to work with any picture name:
>
> Sub FotoCopy()
> '
> ' FotoCopy Macro
> ' Macro recorded 3/16/2007 by ER
> '
> ' Keyboard Shortcut: Ctrl+d
> '
> ActiveSheet.Shapes("Picture 339").Select
> Selection.Copy
> ActiveSheet.Shapes("Picture 253").Select
> ActiveSheet.Paste
> Selection.ShapeRange.IncrementLeft 225.75
> Selection.ShapeRange.IncrementTop -12#
> ActiveSheet.Shapes("Picture 335").Select
> Selection.Copy
> ActiveSheet.Shapes("Picture 261").Select
> ActiveSheet.Paste
> Selection.ShapeRange.IncrementLeft 226.5
> Selection.ShapeRange.IncrementTop -12#
> ActiveWindow.ScrollRow = 4
> ActiveWindow.ScrollRow = 5
> ActiveWindow.ScrollRow = 6
> ActiveWindow.ScrollRow = 7
> ActiveWindow.ScrollRow = 8
> ActiveWindow.ScrollRow = 9
> ActiveWindow.ScrollRow = 10
> ActiveWindow.ScrollRow = 11
> ActiveSheet.Shapes("Picture 336").Select
> Selection.Copy
> ActiveSheet.Shapes("Picture 271").Select
> ActiveSheet.Paste
> Selection.ShapeRange.IncrementLeft 226.5
> Selection.ShapeRange.IncrementTop -12#
> ActiveWindow.ScrollRow = 12
> ActiveWindow.ScrollRow = 13
> ActiveWindow.ScrollRow = 14
> ActiveWindow.ScrollRow = 15
> ActiveWindow.ScrollRow = 16
> ActiveWindow.ScrollRow = 18
> ActiveWindow.ScrollRow = 19
> ActiveWindow.ScrollRow = 20
> ActiveSheet.Shapes("Picture 337").Select
> Selection.Copy
> ActiveSheet.Shapes("Picture 281").Select
> ActiveSheet.Paste
> Selection.ShapeRange.IncrementLeft 226.5
> Selection.ShapeRange.IncrementTop -13.5
> End Sub
>
> Thank you for you help

 
Reply With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      17th Mar 2007
State the cell under the upper left corner of each picture and where you
want each picture copied to in terms of what the cell would be under the
upper left corner.

Sub CopyPictures()
Dim vCurrent As Variant, vFuture As Variant
Dim i As Long, pic As Picture
vCurrent = Array("A1", "A11", "A21", "A31")
vFuture = Array("M11", "M1", "M31", "M21")
For i = LBound(vCurrent) To UBound(vCurrent)
For Each pic In ActiveSheet.Pictures
If pic.TopLeftCell.Address(0, 0) = vCurrent(i) Then
pic.Copy
Range(vFuture(i)).Select
ActiveSheet.Paste
Exit For
End If
Next pic
Next i
End Sub

You have to specify something about the pictures to use to identify which
picture to copy to where. Hopefully specifying the cell underneath the
upper left corner is consistent with what you are doing.

--
Regards,
Tom Ogilvy

"Get a file name inside a macro"
<(E-Mail Removed)> wrote in message
news:B1D9C7A1-BBFA-495C-A435-(E-Mail Removed)...
> Hi everyone:
>
> I have a worksheet with 4 pictures on it, I need to copy this pictures in
> the same worsheet but in a diferent location, I need to make the picture
> name
> generic.
> I want to make the following macro to work with any picture name:
>
> Sub FotoCopy()
> '
> ' FotoCopy Macro
> ' Macro recorded 3/16/2007 by ER
> '
> ' Keyboard Shortcut: Ctrl+d
> '
> ActiveSheet.Shapes("Picture 339").Select
> Selection.Copy
> ActiveSheet.Shapes("Picture 253").Select
> ActiveSheet.Paste
> Selection.ShapeRange.IncrementLeft 225.75
> Selection.ShapeRange.IncrementTop -12#
> ActiveSheet.Shapes("Picture 335").Select
> Selection.Copy
> ActiveSheet.Shapes("Picture 261").Select
> ActiveSheet.Paste
> Selection.ShapeRange.IncrementLeft 226.5
> Selection.ShapeRange.IncrementTop -12#
> ActiveWindow.ScrollRow = 4
> ActiveWindow.ScrollRow = 5
> ActiveWindow.ScrollRow = 6
> ActiveWindow.ScrollRow = 7
> ActiveWindow.ScrollRow = 8
> ActiveWindow.ScrollRow = 9
> ActiveWindow.ScrollRow = 10
> ActiveWindow.ScrollRow = 11
> ActiveSheet.Shapes("Picture 336").Select
> Selection.Copy
> ActiveSheet.Shapes("Picture 271").Select
> ActiveSheet.Paste
> Selection.ShapeRange.IncrementLeft 226.5
> Selection.ShapeRange.IncrementTop -12#
> ActiveWindow.ScrollRow = 12
> ActiveWindow.ScrollRow = 13
> ActiveWindow.ScrollRow = 14
> ActiveWindow.ScrollRow = 15
> ActiveWindow.ScrollRow = 16
> ActiveWindow.ScrollRow = 18
> ActiveWindow.ScrollRow = 19
> ActiveWindow.ScrollRow = 20
> ActiveSheet.Shapes("Picture 337").Select
> Selection.Copy
> ActiveSheet.Shapes("Picture 281").Select
> ActiveSheet.Paste
> Selection.ShapeRange.IncrementLeft 226.5
> Selection.ShapeRange.IncrementTop -13.5
> End Sub
>
> Thank you for you help



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
no attachment icon with photos/can't copy & paste photos onehotmama Microsoft Outlook Discussion 1 25th Jun 2008 07:44 PM
copy photos to cd =?Utf-8?B?TEs=?= Windows XP Photos 1 5th Sep 2007 06:46 PM
Cannot copy photos to CD =?Utf-8?B?am13aG9zaA==?= Windows Vista General Discussion 8 23rd Aug 2007 09:12 AM
cannot copy photos to cd =?Utf-8?B?ZWFydGhtb25rZXk=?= Windows XP New Users 1 11th Jan 2007 12:13 AM
Copy photos to cd =?Utf-8?B?Q2hlcmU=?= Windows XP New Users 4 27th Oct 2005 09:05 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:50 PM.