Results 1 to 13 of 13
  1. #1
    Star Lounger
    Join Date
    Oct 2001
    Location
    Ellettsville, Indiana, USA
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Word-Macro (2000)

    I would like to record a macro in word that will allow me to insert clip art then ungroup it so that I may pull it apart. In powerpoint you can ungroup and group with ease...so I tried recording the macro to include powerpoint as my ungrouper but it did not work. Is there a solution? <img src=/S/help.gif border=0 alt=help width=23 height=15>

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Word-Macro (2000)

    First time I've every seen Word harder than PoPo. Is this what you want? I hope so, because it has me boggled. After the macro, you can select the shapes, but you still cannot ungroup them. Looks like you may have to send it to PoPo and have it convert the wfm to a drawing object then send it back to Word. Is that what you want to do? --Sam
    <pre>Option Explicit
    Sub Macro1()
    Dim clip As InlineShape
    Set clip = ActiveDocument.InlineShapes.AddPicture(FileName:= _
    "C:Program FilesCommon FilesMicrosoft SharedClipartcagcat50BL00393_.wmf" _
    , LinkToFile:=False, SaveWithDocument:=True)
    clip.Activate
    End Sub</pre>

    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  3. #3
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Word-Macro (2000)

    Tanya, hopefully, here is what you want. There must be an easier way! HTH --Sam
    <pre>Option Explicit
    Sub InsertClip()
    Dim ppApp As New PowerPoint.Application
    Dim ppPres As PowerPoint.Presentation
    Dim ppSlide As PowerPoint.Slide
    Dim ppShape As PowerPoint.Shape
    Dim wdShape As Word.Shape
    Set ppPres = ppApp.Presentations.Add(withwindow:=False)
    Set ppSlide = ppPres.Slides.Add(Index:=1, Layout:=ppLayoutBlank)
    Set ppShape = ppSlide.Shapes.AddPicture(FileName:= _
    "C:Program FilesCommon FilesMicrosoft SharedClipartcagcat50BL00393_.wmf", _
    LinkToFile:=msoFalse, SaveWithDocument:=msoTrue, Left:=1, Top:=1)
    ppShape.Copy
    Selection.Paste
    Selection.ShapeRange.Ungroup.Select
    ' Clean Up!
    ppPres.Close
    ppApp.Quit
    Set ppShape = Nothing
    Set ppSlide = Nothing
    Set ppPres = Nothing
    Set ppApp = Nothing
    End Sub</pre>

    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  4. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word-Macro (2000)

    Sammy,

    This seems to work:

    Set clip = ActiveDocument.InlineShapes.AddPicture(FileName:= _
    "C:Program FilesCommon FilesMicrosoft SharedClipartcagcat50BL00393_.wmf" _
    , LinkToFile:=False, SaveWithDocument:=True)

    clip.Select
    selection.ShapeRange.Ungroup
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  5. #5
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Word-Macro (2000)

    With Word2K and Win2K, your code gives me #4198, "Command Failed" on the Ungroup! --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  6. #6
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word-Macro (2000)

    Wow, something that works fine in Word 97 is a bomb in the upgrades. Go figure!
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  7. #7
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Word-Macro (2000)

    That's why I have VB 5 and Office 97 at home and am mad that I had to "upgrade" to Win 98 to use the USB port! Win 95 was the best! (But, I'm just an old Fortran programmer and set in my ways!)
    -- <img src=/S/gramps.gif border=0 alt=gramps width=20 height=20>
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  8. #8
    Star Lounger
    Join Date
    Oct 2001
    Location
    Ellettsville, Indiana, USA
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word-Macro (2000)

    Not being the VBA expert here...but I have tried both and neither of them work. In looking at the one with Powerpoint... do I have to have powerpoint open, do I need to have a slide with clip art in it? When I run it I get the command error message and it highlights the "powerpoint as new application.powerpoint" line.

  9. #9
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Word-Macro (2000)

    Sorry, you must add a reference to PP: In VBA, use the Tools> References menu and check the Microsoft PowerPoint 9.0 Object Library checkbox. Slipped my mind! --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  10. #10
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts

    Re: Word-Macro (2000)

    The reason for this failing in later versions of Word is because pictures now default to being inline, instead of being shape objects.

    This slight variant on the earlier post works fine in Word 2000 on Windows 98SE

    Set Clip = ActiveDocument.InlineShapes.AddPicture(FileName:= _
    "C:Program FilesCommon FilesMicrosoft SharedClipartcagcat50BL00393_.wmf" _
    , LinkToFile:=False, SaveWithDocument:=True)

    NextShape = ActiveDocument.Shapes.Count
    Clip.ConvertToShape
    ActiveDocument.Shapes(NextShape + 1).Ungroup

    StuartR

  11. #11
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word-Macro (2000)

    Hey man,

    Way to go. And thanks for the insight re: in line.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  12. #12
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Word-Macro (2000)

    <img src=/S/bravo.gif border=0 alt=bravo width=16 height=30>Bravo Stuart! Say good-bye, PowerPoint! Now for poor Tanya, doll, here is the macro that you really need and you can get rid of the PowerPoint Reference (Tools>References & uncheck it)
    <pre>Option Explicit
    Sub UngroupClip()
    Dim clip As InlineShape
    Dim shp As Shape
    Set clip = ActiveDocument.InlineShapes.AddPicture(FileName:= _
    "C:Program FilesCommon FilesMicrosoft SharedClipartcagcat50BL00393_.wmf" _
    , LinkToFile:=False, SaveWithDocument:=True)
    Set shp = clip.ConvertToShape
    shp.Ungroup.Select
    End Sub</pre>

    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  13. #13
    Star Lounger
    Join Date
    Oct 2001
    Location
    Ellettsville, Indiana, USA
    Posts
    76
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Word-Macro (2000)

    Hey! I just want to say thank you.....YOU ROCK!

Posting Permissions

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