Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 07-10-2017, 06:27 PM
gmaxey gmaxey is offline Macro for removing cross-reference fields with specific contents Windows 7 32bit Macro for removing cross-reference fields with specific contents Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,617
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Add a formatting switch:

Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey, http://gregmaxey.com/word_tips.html, 7/10/2017
Dim oFld As Field
  For Each oFld In ActiveDocument.Fields
    If oFld.Type = 3 Then
      oFld.Select
      If Not InStr(oFld.Code.Text, "\* Lower") > 0 Then
        If MsgBox("Format with lower case?", vbQuestion + vbYesNo, "FORMAT") = vbYes Then
          If InStr(oFld.Code.Text, "\h") > 0 Then
            oFld.Code.Text = Replace(oFld.Code.Text, "\h", "\* Lower \h")
          End If
          oFld.Update
        End If
      Else
        If MsgBox("Format with upper case?", vbQuestion + vbYesNo, "FORMAT") = vbYes Then
          If InStr(oFld.Code.Text, "\h") > 0 Then
            oFld.Code.Text = Replace(oFld.Code.Text, "\* Lower \h", "\h")
          End If
          oFld.Update
        End If
      End If
    End If
  Next
End Sub
lbl_Exit:
  Exit Sub
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 

Tags
cross-reference, macro, unlink



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for removing cross-reference fields with specific contents Cross Reference REF fields Unlink mktate Word VBA 7 06-24-2016 05:55 AM
Cross reference is bad. Leffken Word 1 06-09-2016 03:12 PM
Macro for removing cross-reference fields with specific contents Totaling specific configuration selections that cross reference multiple fields (tricky) lonniepoet Excel Programming 1 06-09-2016 09:54 AM
Macro for removing cross-reference fields with specific contents Reference number and cross reference for equation numbers to match the thesis format wmac Word 1 05-14-2013 08:54 PM
manipulating cross-reference fields _wim_ Word 0 12-10-2010 05:52 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:13 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft