Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

Find and replace graphics.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dragoncity - 27 Oct 2006 10:56 GMT
Hi,
I'm very new to macros and VBA, and need help.

I need to replace all the graphics in a Word document using Paste Special so
they are converted from HTML linked images to embedded images.

I have recorded the macro to do this, but I want the whole action to repeat
(find graphic, cut, paste, move to next graphic)

I have tried to look at the samples available, but I'm WAAAAY above my head
on this. Any help would be just peachy :)

My current macro is:

Sub ChangeImage()
'
' ChangeImage Macro
' Macro recorded 27/10/06 by Nicola Harlow
'
   Selection.Find.ClearFormatting
   With Selection.Find
       .Text = "^g"
       .Replacement.Text = ""
       .Forward = True
       .Wrap = wdFindContinue
       .Format = False
       .MatchCase = False
       .MatchWholeWord = False
       .MatchWildcards = False
       .MatchSoundsLike = False
       .MatchAllWordForms = False
   End With
   Selection.Find.Execute
   Selection.Cut
   Selection.PasteSpecial Link:=False, DataType:=wdPasteOLEObject,
Placement _
       :=wdInLine, DisplayAsIcon:=False
End Sub

I've tried Repeat, but that just re-does the paste. Not useful.

Thanks,

Nicola :)
Graham Mayor - 27 Oct 2006 12:49 GMT
Am I missing something here - will CTRL+A - then - CTRL+SHIFT+F9 not do what
you want?

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> Hi,
> I'm very new to macros and VBA, and need help.
[quoted text clipped - 41 lines]
>
> Nicola :)
Dragoncity - 27 Oct 2006 13:01 GMT
Sorry, what does CTRL+SHIFT+F9 do?

If it does what I want then that's great! :)

> Am I missing something here - will CTRL+A - then - CTRL+SHIFT+F9 not do what
> you want?
[quoted text clipped - 44 lines]
> >
> > Nicola :)
Dragoncity - 27 Oct 2006 13:05 GMT
My bad, should have tried it first.

That's a great shortcut, thanks! I converts them easily :)

Thank you so much, that's saved me a lot of hassle!

Nicola

> Am I missing something here - will CTRL+A - then - CTRL+SHIFT+F9 not do what
> you want?
[quoted text clipped - 44 lines]
> >
> > Nicola :)
Dragoncity - 27 Oct 2006 13:40 GMT
Sorry, after investigation I discovered that it removed all of the hyperlinks
as well. Although having hyperlinks in Word is not ideal, it's better than
nothing!

So I still need to find a way of repeating the code down the document.
Suggestions? Ta.

> Am I missing something here - will CTRL+A - then - CTRL+SHIFT+F9 not do what
> you want?
[quoted text clipped - 44 lines]
> >
> > Nicola :)
Dave Lett - 30 Oct 2006 15:47 GMT
Hi,

Does the following meet your needs?

Dim iFld As Integer

For iFld = ActiveDocument.Fields.Count To 1 Step -1
   With ActiveDocument.Fields(iFld)
       If .Type = wdFieldIncludePicture Then
           .Unlink
       End If
   End With
Next iFld

HTH,

Dave

> Sorry, after investigation I discovered that it removed all of the
> hyperlinks
[quoted text clipped - 53 lines]
>> >
>> > Nicola :)
Dragoncity - 30 Oct 2006 16:09 GMT
Perfect, thanks! :)

Nicola

> Hi,
>
[quoted text clipped - 71 lines]
> >> >
> >> > Nicola :)

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.