View Single Post
 
Old 01-20-2016, 03:00 AM
ChrisJ83 ChrisJ83 is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Nov 2015
Posts: 9
ChrisJ83 is on a distinguished road
Default Repeat macro until no more fields

Hi

I am trying to create a macro in Word which finds the next field, selects it and then changes the background colour to no fill.

I couldn't find a way of only selecting the field so it selects the whole line but that is fine, unless selecting the field on its own is easy enough?

My main question is how would I look the below code?

I have very limited knowledge of macros and I try and patch things together using the record function and references from the internet, so apologies for the state of the below code.

HTML Code:
Sub ASelect1()
'
' ASelect1 Macro
'
'
Selection.GoTo What:=wdGoToField, Name:="MergeField"
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Shading.Texture = wdTextureNone
Selection.Shading.ForegroundPatternColor = wdColorAutomatic
Selection.Shading.BackgroundPatternColor = wdColorAutomatic
End Sub
Any help/advice appreciated.

Cheers
Reply With Quote