Jay
Thu Dec 07 19:15:26 CST 2006
In point of fact, if the "Typing replaces selection" option is turned
on, the field is deleted automatically, because clicking the
macrobutton to activate it also selects it. Since the OP said his
fields were {MacroButton InsertPicture}, the inserted picture will
replace the field, if that option is set. (But if the InsertPicture
command is being intercepted by a macro of the same name, it could be
doing almost anything.)
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ:
http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.
On Fri, 8 Dec 2006 11:02:03 +1100, "macropod"
<invalid@invalid.invalid> wrote:
>Hi Jay,
>
>Interesting, yes, but from a user's perspective, it would probably be even
>more efficient to code the macro triggered by the macrobutton field to
>delete the calling field as part of the process.
>
>Cheers
>
>--
>macropod
>[MVP - Microsoft Word]
>
>
>"Jay Freedman" <jay.freedman@verizon.net> wrote in message
>news:ia4gn29qlcb7vr9pjnivhkh6i0udaalusn@4ax.com...
>> It would be interesting to compare these two for speed in a large
>> document with a few hundred fields.
>>
>> I'd like to see a contest for the operation in Word that has the most
>> possible ways of being programmed. :-)
>>
>> On Thu, 7 Dec 2006 16:54:47 +1100, "macropod"
>> <invalid@invalid.invalid> wrote:
>>
>> >Or this:
>> >
>> >Sub KillMacroButtonFields()
>> >Dim oFld As Field
>> >If ActiveDocument.Fields.Count > 0 Then
>> > For Each oFld In ActiveDocument.Fields
>> > If oFld.Type = wdFieldMacroButton Then oFld.Delete
>> > Next oFld
>> >End If
>> >End Sub
>> >
>> >Cheers
>> >
>> >--
>> >macropod
>> >[MVP - Microsoft Word]
>> >
>> >
>> >"Jay Freedman" <jay.freedman@verizon.net> wrote in message
>> >news:tk6fn2d9d1tpk9lethusfk0g9h4rkcl6jl@4ax.com...
>> >> Use something like this:
>> >>
>> >> Dim oRg As Range
>> >> Set oRg = ActiveDocument.Range
>> >> oRg.TextRetrievalMode.IncludeFieldCodes = True
>> >> With oRg.Find
>> >> .ClearFormatting
>> >> .Text = "^d macrobutton"
>> >> .Replacement.Text = ""
>> >> .Forward = True
>> >> .Wrap = wdFindContinue
>> >> .Format = False
>> >> .MatchWildcards = False
>> >> .Execute Replace:=wdReplaceAll
>> >> End With
>> >>
>> >> The .TextRetrievalMode.IncludeFieldCodes lets the search look inside
>> >> the field codes even when they're toggled off. The ^d represents the
>> >> opening field brace; when that's selected, the entire field is
>> >> selected, so replacing with nothing deletes the field.
>> >>
>> >> --
>> >> Regards,
>> >> Jay Freedman
>> >> Microsoft Word MVP FAQ:
http://word.mvps.org
>> >> Email cannot be acknowledged; please post all follow-ups to the
>> >> newsgroup so all may benefit.
>> >>
>> >> On Wed, 6 Dec 2006 18:11:01 -0800, Billy B
>> >> <BillyB@discussions.microsoft.com> wrote:
>> >>
>> >> >I have a table in a Word2000 document. In the table, I have multiple
>> >> >{macrobutton insertpicture} fields. After inserting the picture, the
>> >> >placeholder and text appear after the picture, taking up space and
>> >displaying
>> >> >the default text. How can I search the document and delete all
>instances
>> >of
>> >> >the macrobutton placeholders? I plan on running the procedure in a
>print
>> >> >procedure code module.
>> >> >
>> >> >Thank you very much.
>> >
>>
>> --
>> Regards,
>> Jay Freedman
>> Microsoft Word MVP FAQ:
http://word.mvps.org
>> Email cannot be acknowledged; please post all follow-ups to the newsgroup
>so all may benefit.
>