Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Jan 2003
    Location
    Michigan, USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Pasting and Resizing (Office 2000)

    I wish to paste into word something on the clipboard as a picture and then modify it. When I do "record a Macro" I get the following code:

    Selection.PasteSpecial Link:=False, DataType:=wdPasteMetafilePicture, _
    Placement:=wdFloatOverText, DisplayAsIcon:=False
    ActiveDocument.Shapes("Picture 26").Select
    Selection.ShapeRange.ScaleWidth 2.22, msoFalse, msoScaleFromTopLeft...

    This doesn't work because the recorder has hard coded "Picture 26" into itself. Obviously I need to know what the actual
    picture name is that I am pasting. I have tried all kinds of variants on "Picname=Selection.PasteSpecial Link:=False", etc, but can't get anything to work.

    Thanks for the help,

  2. #2
    5 Star Lounger
    Join Date
    Jul 2002
    Location
    Toronto, Ontario, Canada
    Posts
    1,139
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Pasting and Resizing (Office 2000)

    Try this:

    dim lngShapeCount as Long

    'Get number of shapes currently in active document
    lngShapeCount = ActiveDocument.Shapes.Count

    'Paste picture
    Selection.PasteSpecial Link:=False, DataType:=wdPasteMetafilePicture, _
    Placement:=wdFloatOverText, DisplayAsIcon:=False

    'Select Shape number ShapeCount before paste plus 1
    ActiveDocument.Shapes(lngShapeCount + 1).Select

    'Continue on with your code
    Selection.ShapeRange.ScaleWidth 2.22, msoFalse, msoScaleFromTopLeft...
    --
    Bryan Carbonnell - Toronto <img src=/S/flags/Ontario.gif border=0 alt=Ontario width=30 height=18> <img src=/S/flags/Canada.gif border=0 alt=Canada width=30 height=18>
    Unfortunately common sense isn't so common!!
    Visit my website for useful Word, Excel and Access code, templates and Add-Ins

  3. #3
    New Lounger
    Join Date
    Jan 2003
    Location
    Michigan, USA
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Pasting and Resizing (Office 2000)

    Thanks, I don't know why I didn't think of that. I will use a variant of that which requires a little less typing and seems to work as well:

    Selection.PasteSpecial Link:=False, DataType:=wdPasteMetafilePicture, _
    Placement:=wdFloatOverText, DisplayAsIcon:=False

    ActiveDocument.Shapes(ActiveDocument.Shapes.Count) .Select
    ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •