WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Creating a Macro

 
Goto page 1, 2, 3, 4
   Home -> Office -> Document Management RSS
Next:  Protecting only a Section of a Form  
Author Message
lewisma

External


Since: Aug 14, 2008
Posts: 16



(Msg. 1) Posted: Thu Aug 14, 2008 8:24 am
Post subject: Creating a Macro
Archived from groups: microsoft>public>word>docmanagement (more info?)

Hi

I need to create a macro which will look through word documents. The macro
will need to look for certain words which are (upper right, upper left,
bottom right and bottom left). These words will then need to be replaced by
some kind of autoshape/symbol.
Upper right would need to become |_
Upper left would need to become _|
Bottom right would need to become | with a line on the right hand side (at
the top)
Bottom left would need to become | with a line on the left hand side (at the
top)
The autoshape/symbol also needs to be active so the typist can type in a
number of 1-8 in the box, this is a dental grid. I know how to record macros
and i am happy finding and replacing words, but this is proving quite
difficult to achieve. Is there any sort of vb script out there that will
accomplish this, what is the best way to get the end result. I am very new to
VB so my knowledge is very limited.
Any help would be very much appreciated. Thanks in advance

lewisma

lewisma
Back to top
Login to vote
lewisma

External


Since: Aug 14, 2008
Posts: 16



(Msg. 2) Posted: Thu Aug 14, 2008 8:27 am
Post subject: RE: Creating a Macro [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I forgot to mention that i'm using Word 2003 SP3
--
lewisma


"lewisma" wrote:

> Hi
>
> I need to create a macro which will look through word documents. The macro
> will need to look for certain words which are (upper right, upper left,
> bottom right and bottom left). These words will then need to be replaced by
> some kind of autoshape/symbol.
> Upper right would need to become |_
> Upper left would need to become _|
> Bottom right would need to become | with a line on the right hand side (at
> the top)
> Bottom left would need to become | with a line on the left hand side (at the
> top)
> The autoshape/symbol also needs to be active so the typist can type in a
> number of 1-8 in the box, this is a dental grid. I know how to record macros
> and i am happy finding and replacing words, but this is proving quite
> difficult to achieve. Is there any sort of vb script out there that will
> accomplish this, what is the best way to get the end result. I am very new to
> VB so my knowledge is very limited.
> Any help would be very much appreciated. Thanks in advance
>
> lewisma
Back to top
Login to vote
Graham Mayor

External


Since: Jul 04, 2006
Posts: 10944



(Msg. 3) Posted: Fri Aug 15, 2008 3:05 am
Post subject: Re: Creating a Macro [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

It is easy enough to run through a document and process a list of words or
phrases, but the problem here is the autoshape and more particularly your
requirement to have a shape that you can write in. The logical shape would
be a table cell, to which you could apply borders to produce the four shapes
and type in the space, but you cannot intersperse table cells with text -
each cell would have to be on its own line.

Text boxes etc are out because you cannot format the edges of the box
individually.

You could use (say) the characters 195/196 199/200 from the Wingdings font,
which would provide suitably adventurous shapes, but you wouldn't be able to
type in the spaces - only alongside.

To do that -

Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long
vFindText = Array("upper right", "upper left", _
"lower right", "lower left")
vReplText = Array(Chr(200), Chr(199), Chr(196), Chr(195))
With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = False
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText(i)
.Replacement.Font.name = "Wingdings"
.Replacement.Font.Size = 14
.Execute Replace:=wdReplaceAll
Next i
End With
End With
End Sub

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

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


lewisma wrote:
> Hi
>
> I need to create a macro which will look through word documents. The
> macro will need to look for certain words which are (upper right,
> upper left, bottom right and bottom left). These words will then need
> to be replaced by some kind of autoshape/symbol.
> Upper right would need to become |_
> Upper left would need to become _|
> Bottom right would need to become | with a line on the right hand
> side (at the top)
> Bottom left would need to become | with a line on the left hand side
> (at the top)
> The autoshape/symbol also needs to be active so the typist can type
> in a number of 1-8 in the box, this is a dental grid. I know how to
> record macros and i am happy finding and replacing words, but this is
> proving quite difficult to achieve. Is there any sort of vb script
> out there that will accomplish this, what is the best way to get the
> end result. I am very new to VB so my knowledge is very limited.
> Any help would be very much appreciated. Thanks in advance
>
> lewisma
>
> lewisma
Back to top
Login to vote
lewisma

External


Since: Aug 14, 2008
Posts: 16



(Msg. 4) Posted: Mon Aug 18, 2008 2:50 am
Post subject: Re: Creating a Macro [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Graham

Many thanks for your quick response. I have just been told that the shape
does not need to have anything typed into it now. So all that needs to be
done is for the phrases to be replaced by the shape. Does this make the end
result a little easier now ?
Look forward to your comments, thanks
--
lewisma


"Graham Mayor" wrote:

> It is easy enough to run through a document and process a list of words or
> phrases, but the problem here is the autoshape and more particularly your
> requirement to have a shape that you can write in. The logical shape would
> be a table cell, to which you could apply borders to produce the four shapes
> and type in the space, but you cannot intersperse table cells with text -
> each cell would have to be on its own line.
>
> Text boxes etc are out because you cannot format the edges of the box
> individually.
>
> You could use (say) the characters 195/196 199/200 from the Wingdings font,
> which would provide suitably adventurous shapes, but you wouldn't be able to
> type in the spaces - only alongside.
>
> To do that -
>
> Sub ReplaceList()
> Dim vFindText As Variant
> Dim vReplText As Variant
> Dim i As Long
> vFindText = Array("upper right", "upper left", _
> "lower right", "lower left")
> vReplText = Array(Chr(200), Chr(199), Chr(196), Chr(195))
> With Selection
> .HomeKey wdStory
> With .Find
> .ClearFormatting
> .Replacement.ClearFormatting
> .Forward = True
> .Wrap = wdFindContinue
> .MatchWholeWord = True
> .MatchWildcards = False
> .MatchSoundsLike = False
> .MatchAllWordForms = False
> .Format = True
> .MatchCase = False
> For i = LBound(vFindText) To UBound(vFindText)
> .Text = vFindText(i)
> .Replacement.Text = vReplText(i)
> .Replacement.Font.name = "Wingdings"
> .Replacement.Font.Size = 14
> .Execute Replace:=wdReplaceAll
> Next i
> End With
> End With
> End Sub
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> lewisma wrote:
> > Hi
> >
> > I need to create a macro which will look through word documents. The
> > macro will need to look for certain words which are (upper right,
> > upper left, bottom right and bottom left). These words will then need
> > to be replaced by some kind of autoshape/symbol.
> > Upper right would need to become |_
> > Upper left would need to become _|
> > Bottom right would need to become | with a line on the right hand
> > side (at the top)
> > Bottom left would need to become | with a line on the left hand side
> > (at the top)
> > The autoshape/symbol also needs to be active so the typist can type
> > in a number of 1-8 in the box, this is a dental grid. I know how to
> > record macros and i am happy finding and replacing words, but this is
> > proving quite difficult to achieve. Is there any sort of vb script
> > out there that will accomplish this, what is the best way to get the
> > end result. I am very new to VB so my knowledge is very limited.
> > Any help would be very much appreciated. Thanks in advance
> >
> > lewisma
> >
> > lewisma
>
>
>
Back to top
Login to vote
lewisma

External


Since: Aug 14, 2008
Posts: 16



(Msg. 5) Posted: Mon Aug 18, 2008 4:25 am
Post subject: Re: Creating a Macro [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I copied and pasted your script into a new word macro, when i try to run it i
get the following error message.

Compile Error: Expected End Sub

Below is the script.

Sub lewis()
'
' lewis Macro
' Macro created 18/08/2008 by MedQuist
'
Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long
vFindText = Array("upper right", "upper left", _
"lower right", "lower left")
vReplText = Array(Chr(200), Chr(199), Chr(196), Chr(195))
With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = False
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText(i)
.Replacement.Font.Name = "Wingdings"
.Replacement.Font.Size = 14
.Execute Replace:=wdReplaceAll
Next i
End With
End With
End Sub


End Sub

Any ideas what i'm doing wrong here ?
Your help is appreciated, thanks
--
lewisma


"lewisma" wrote:

> Graham
>
> Many thanks for your quick response. I have just been told that the shape
> does not need to have anything typed into it now. So all that needs to be
> done is for the phrases to be replaced by the shape. Does this make the end
> result a little easier now ?
> Look forward to your comments, thanks
> --
> lewisma
>
>
> "Graham Mayor" wrote:
>
> > It is easy enough to run through a document and process a list of words or
> > phrases, but the problem here is the autoshape and more particularly your
> > requirement to have a shape that you can write in. The logical shape would
> > be a table cell, to which you could apply borders to produce the four shapes
> > and type in the space, but you cannot intersperse table cells with text -
> > each cell would have to be on its own line.
> >
> > Text boxes etc are out because you cannot format the edges of the box
> > individually.
> >
> > You could use (say) the characters 195/196 199/200 from the Wingdings font,
> > which would provide suitably adventurous shapes, but you wouldn't be able to
> > type in the spaces - only alongside.
> >
> > To do that -
> >
> > Sub ReplaceList()
> > Dim vFindText As Variant
> > Dim vReplText As Variant
> > Dim i As Long
> > vFindText = Array("upper right", "upper left", _
> > "lower right", "lower left")
> > vReplText = Array(Chr(200), Chr(199), Chr(196), Chr(195))
> > With Selection
> > .HomeKey wdStory
> > With .Find
> > .ClearFormatting
> > .Replacement.ClearFormatting
> > .Forward = True
> > .Wrap = wdFindContinue
> > .MatchWholeWord = True
> > .MatchWildcards = False
> > .MatchSoundsLike = False
> > .MatchAllWordForms = False
> > .Format = True
> > .MatchCase = False
> > For i = LBound(vFindText) To UBound(vFindText)
> > .Text = vFindText(i)
> > .Replacement.Text = vReplText(i)
> > .Replacement.Font.name = "Wingdings"
> > .Replacement.Font.Size = 14
> > .Execute Replace:=wdReplaceAll
> > Next i
> > End With
> > End With
> > End Sub
> >
> > --
> > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> > Graham Mayor - Word MVP
> >
> > My web site www.gmayor.com
> > Word MVP web site http://word.mvps.org
> > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >
> >
> > lewisma wrote:
> > > Hi
> > >
> > > I need to create a macro which will look through word documents. The
> > > macro will need to look for certain words which are (upper right,
> > > upper left, bottom right and bottom left). These words will then need
> > > to be replaced by some kind of autoshape/symbol.
> > > Upper right would need to become |_
> > > Upper left would need to become _|
> > > Bottom right would need to become | with a line on the right hand
> > > side (at the top)
> > > Bottom left would need to become | with a line on the left hand side
> > > (at the top)
> > > The autoshape/symbol also needs to be active so the typist can type
> > > in a number of 1-8 in the box, this is a dental grid. I know how to
> > > record macros and i am happy finding and replacing words, but this is
> > > proving quite difficult to achieve. Is there any sort of vb script
> > > out there that will accomplish this, what is the best way to get the
> > > end result. I am very new to VB so my knowledge is very limited.
> > > Any help would be very much appreciated. Thanks in advance
> > >
> > > lewisma
> > >
> > > lewisma
> >
> >
> >
Back to top
Login to vote
lewisma

External


Since: Aug 14, 2008
Posts: 16



(Msg. 6) Posted: Mon Aug 18, 2008 4:48 am
Post subject: Re: Creating a Macro [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

After some playing about i now have it working, but when i run the macro
inside word it only changes the upper right and upper left phrases, it
doesn't do anything for the bottom right and bottom left values, once that is
working i guess i just need to figure out what to replace the phrases with,
the font looks ok but i would really need the 2 lines for each phrase.

Thanks
--
lewisma


"lewisma" wrote:

> I copied and pasted your script into a new word macro, when i try to run it i
> get the following error message.
>
> Compile Error: Expected End Sub
>
> Below is the script.
>
> Sub lewis()
> '
> ' lewis Macro
> ' Macro created 18/08/2008 by MedQuist
> '
> Sub ReplaceList()
> Dim vFindText As Variant
> Dim vReplText As Variant
> Dim i As Long
> vFindText = Array("upper right", "upper left", _
> "lower right", "lower left")
> vReplText = Array(Chr(200), Chr(199), Chr(196), Chr(195))
> With Selection
> .HomeKey wdStory
> With .Find
> .ClearFormatting
> .Replacement.ClearFormatting
> .Forward = True
> .Wrap = wdFindContinue
> .MatchWholeWord = True
> .MatchWildcards = False
> .MatchSoundsLike = False
> .MatchAllWordForms = False
> .Format = True
> .MatchCase = False
> For i = LBound(vFindText) To UBound(vFindText)
> .Text = vFindText(i)
> .Replacement.Text = vReplText(i)
> .Replacement.Font.Name = "Wingdings"
> .Replacement.Font.Size = 14
> .Execute Replace:=wdReplaceAll
> Next i
> End With
> End With
> End Sub
>
>
> End Sub
>
> Any ideas what i'm doing wrong here ?
> Your help is appreciated, thanks
> --
> lewisma
>
>
> "lewisma" wrote:
>
> > Graham
> >
> > Many thanks for your quick response. I have just been told that the shape
> > does not need to have anything typed into it now. So all that needs to be
> > done is for the phrases to be replaced by the shape. Does this make the end
> > result a little easier now ?
> > Look forward to your comments, thanks
> > --
> > lewisma
> >
> >
> > "Graham Mayor" wrote:
> >
> > > It is easy enough to run through a document and process a list of words or
> > > phrases, but the problem here is the autoshape and more particularly your
> > > requirement to have a shape that you can write in. The logical shape would
> > > be a table cell, to which you could apply borders to produce the four shapes
> > > and type in the space, but you cannot intersperse table cells with text -
> > > each cell would have to be on its own line.
> > >
> > > Text boxes etc are out because you cannot format the edges of the box
> > > individually.
> > >
> > > You could use (say) the characters 195/196 199/200 from the Wingdings font,
> > > which would provide suitably adventurous shapes, but you wouldn't be able to
> > > type in the spaces - only alongside.
> > >
> > > To do that -
> > >
> > > Sub ReplaceList()
> > > Dim vFindText As Variant
> > > Dim vReplText As Variant
> > > Dim i As Long
> > > vFindText = Array("upper right", "upper left", _
> > > "lower right", "lower left")
> > > vReplText = Array(Chr(200), Chr(199), Chr(196), Chr(195))
> > > With Selection
> > > .HomeKey wdStory
> > > With .Find
> > > .ClearFormatting
> > > .Replacement.ClearFormatting
> > > .Forward = True
> > > .Wrap = wdFindContinue
> > > .MatchWholeWord = True
> > > .MatchWildcards = False
> > > .MatchSoundsLike = False
> > > .MatchAllWordForms = False
> > > .Format = True
> > > .MatchCase = False
> > > For i = LBound(vFindText) To UBound(vFindText)
> > > .Text = vFindText(i)
> > > .Replacement.Text = vReplText(i)
> > > .Replacement.Font.name = "Wingdings"
> > > .Replacement.Font.Size = 14
> > > .Execute Replace:=wdReplaceAll
> > > Next i
> > > End With
> > > End With
> > > End Sub
> > >
> > > --
> > > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> > > Graham Mayor - Word MVP
> > >
> > > My web site www.gmayor.com
> > > Word MVP web site http://word.mvps.org
> > > <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> > >
> > >
> > > lewisma wrote:
> > > > Hi
> > > >
> > > > I need to create a macro which will look through word documents. The
> > > > macro will need to look for certain words which are (upper right,
> > > > upper left, bottom right and bottom left). These words will then need
> > > > to be replaced by some kind of autoshape/symbol.
> > > > Upper right would need to become |_
> > > > Upper left would need to become _|
> > > > Bottom right would need to become | with a line on the right hand
> > > > side (at the top)
> > > > Bottom left would need to become | with a line on the left hand side
> > > > (at the top)
> > > > The autoshape/symbol also needs to be active so the typist can type
> > > > in a number of 1-8 in the box, this is a dental grid. I know how to
> > > > record macros and i am happy finding and replacing words, but this is
> > > > proving quite difficult to achieve. Is there any sort of vb script
> > > > out there that will accomplish this, what is the best way to get the
> > > > end result. I am very new to VB so my knowledge is very limited.
> > > > Any help would be very much appreciated. Thanks in advance
> > > >
> > > > lewisma
> > > >
> > > > lewisma
> > >
> > >
> > >
Back to top
Login to vote
Graham Mayor

External


Since: Jul 04, 2006
Posts: 10944



(Msg. 7) Posted: Mon Aug 18, 2008 2:35 pm
Post subject: Re: Creating a Macro [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

If you can find suitable characters and substitute them in and the font they
are derived from in the macro I posted, it will do just that.. Digging
around in Unicode fonts for some suitable shape I came up with the following
which uses box drawing shapes from the Arial Unicode font, which is a fairly
standard font that you will have.

Sub ReplaceList()
Dim vFindText As Variant
Dim vReplText As Variant
Dim i As Long
vFindText = Array("upper left", "upper right", "lower left", "lower right")
vReplText = Array(ChrW(9496), ChrW(9492), ChrW(9488), ChrW(9484))
With Selection
.HomeKey wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Forward = True
.Wrap = wdFindContinue
.MatchWholeWord = True
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Format = True
.MatchCase = False
For i = LBound(vFindText) To UBound(vFindText)
.Text = vFindText(i)
.Replacement.Text = vReplText(i)
.Replacement.Font.name = "Arial"
.Replacement.Font.Size = 14
.Execute Replace:=wdReplaceAll
Next i
End With
End With
End Sub

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

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


lewisma wrote:
> Graham
>
> Many thanks for your quick response. I have just been told that the
> shape does not need to have anything typed into it now. So all that
> needs to be done is for the phrases to be replaced by the shape. Does
> this make the end result a little easier now ?
> Look forward to your comments, thanks
>
>> It is easy enough to run through a document and process a list of
>> words or phrases, but the problem here is the autoshape and more
>> particularly your requirement to have a shape that you can write in.
>> The logical shape would be a table cell, to which you could apply
>> borders to produce the four shapes and type in the space, but you
>> cannot intersperse table cells with text - each cell would have to
>> be on its own line.
>>
>> Text boxes etc are out because you cannot format the edges of the box
>> individually.
>>
>> You could use (say) the characters 195/196 199/200 from the
>> Wingdings font, which would provide suitably adventurous shapes, but
>> you wouldn't be able to type in the spaces - only alongside.
>>
>> To do that -
>>
>> Sub ReplaceList()
>> Dim vFindText As Variant
>> Dim vReplText As Variant
>> Dim i As Long
>> vFindText = Array("upper right", "upper left", _
>> "lower right", "lower left")
>> vReplText = Array(Chr(200), Chr(199), Chr(196), Chr(195))
>> With Selection
>> .HomeKey wdStory
>> With .Find
>> .ClearFormatting
>> .Replacement.ClearFormatting
>> .Forward = True
>> .Wrap = wdFindContinue
>> .MatchWholeWord = True
>> .MatchWildcards = False
>> .MatchSoundsLike = False
>> .MatchAllWordForms = False
>> .Format = True
>> .MatchCase = False
>> For i = LBound(vFindText) To UBound(vFindText)
>> .Text = vFindText(i)
>> .Replacement.Text = vReplText(i)
>> .Replacement.Font.name = "Wingdings"
>> .Replacement.Font.Size = 14
>> .Execute Replace:=wdReplaceAll
>> Next i
>> End With
>> End With
>> End Sub
>>
>> --
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>> Graham Mayor - Word MVP
>>
>> My web site www.gmayor.com
>> Word MVP web site http://word.mvps.org
>> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>>
>>
>> lewisma wrote:
>>> Hi
>>>
>>> I need to create a macro which will look through word documents. The
>>> macro will need to look for certain words which are (upper right,
>>> upper left, bottom right and bottom left). These words will then
>>> need to be replaced by some kind of autoshape/symbol.
>>> Upper right would need to become |_
>>> Upper left would need to become _|
>>> Bottom right would need to become | with a line on the right hand
>>> side (at the top)
>>> Bottom left would need to become | with a line on the left hand side
>>> (at the top)
>>> The autoshape/symbol also needs to be active so the typist can type
>>> in a number of 1-8 in the box, this is a dental grid. I know how to
>>> record macros and i am happy finding and replacing words, but this
>>> is proving quite difficult to achieve. Is there any sort of vb
>>> script out there that will accomplish this, what is the best way to
>>> get the end result. I am very new to VB so my knowledge is very
>>> limited.
>>> Any help would be very much appreciated. Thanks in advance
>>>
>>> lewisma
>>>
>>> lewisma
Back to top
Login to vote
lewisma

External


Since: Aug 14, 2008
Posts: 16



(Msg. 8) Posted: Mon Aug 18, 2008 2:35 pm
Post subject: Re: Creating a Macro [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Graham

This is fantastic, i will give it a try, what's the best way to get the
script into a macro, before i just went into Word/Macro and Create Macro,
named it and just pasted in the script, should i be doing it that way or is
there another way to do this ?
Thanks
--
lewisma


"Graham Mayor" wrote:

> If you can find suitable characters and substitute them in and the font they
> are derived from in the macro I posted, it will do just that.. Digging
> around in Unicode fonts for some suitable shape I came up with the following
> which uses box drawing shapes from the Arial Unicode font, which is a fairly
> standard font that you will have.
>
> Sub ReplaceList()
> Dim vFindText As Variant
> Dim vReplText As Variant
> Dim i As Long
> vFindText = Array("upper left", "upper right", "lower left", "lower right")
> vReplText = Array(ChrW(9496), ChrW(9492), ChrW(9488), ChrW(9484))
> With Selection
> .HomeKey wdStory
> With .Find
> .ClearFormatting
> .Replacement.ClearFormatting
> .Forward = True
> .Wrap = wdFindContinue
> .MatchWholeWord = True
> .MatchWildcards = False
> .MatchSoundsLike = False
> .MatchAllWordForms = False
> .Format = True
> .MatchCase = False
> For i = LBound(vFindText) To UBound(vFindText)
> .Text = vFindText(i)
> .Replacement.Text = vReplText(i)
> .Replacement.Font.name = "Arial"
> .Replacement.Font.Size = 14
> .Execute Replace:=wdReplaceAll
> Next i
> End With
> End With
> End Sub
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
>
> lewisma wrote:
> > Graham
> >
> > Many thanks for your quick response. I have just been told that the
> > shape does not need to have anything typed into it now. So all that
> > needs to be done is for the phrases to be replaced by the shape. Does
> > this make the end result a little easier now ?
> > Look forward to your comments, thanks
> >
> >> It is easy enough to run through a document and process a list of
> >> words or phrases, but the problem here is the autoshape and more
> >> particularly your requirement to have a shape that you can write in.
> >> The logical shape would be a table cell, to which you could apply
> >> borders to produce the four shapes and type in the space, but you
> >> cannot intersperse table cells with text - each cell would have to
> >> be on its own line.
> >>
> >> Text boxes etc are out because you cannot format the edges of the box
> >> individually.
> >>
> >> You could use (say) the characters 195/196 199/200 from the
> >> Wingdings font, which would provide suitably adventurous shapes, but
> >> you wouldn't be able to type in the spaces - only alongside.
> >>
> >> To do that -
> >>
> >> Sub ReplaceList()
> >> Dim vFindText As Variant
> >> Dim vReplText As Variant
> >> Dim i As Long
> >> vFindText = Array("upper right", "upper left", _
> >> "lower right", "lower left")
> >> vReplText = Array(Chr(200), Chr(199), Chr(196), Chr(195))
> >> With Selection
> >> .HomeKey wdStory
> >> With .Find
> >> .ClearFormatting
> >> .Replacement.ClearFormatting
> >> .Forward = True
> >> .Wrap = wdFindContinue
> >> .MatchWholeWord = True
> >> .MatchWildcards = False
> >> .MatchSoundsLike = False
> >> .MatchAllWordForms = False
> >> .Format = True
> >> .MatchCase = False
> >> For i = LBound(vFindText) To UBound(vFindText)
> >> .Text = vFindText(i)
> >> .Replacement.Text = vReplText(i)
> >> .Replacement.Font.name = "Wingdings"
> >> .Replacement.Font.Size = 14
> >> .Execute Replace:=wdReplaceAll
> >> Next i
> >> End With
> >> End With
> >> End Sub
> >>
> >> --
> >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >> Graham Mayor - Word MVP
> >>
> >> My web site www.gmayor.com
> >> Word MVP web site http://word.mvps.org
> >> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> >>
> >>
> >> lewisma wrote:
> >>> Hi
> >>>
> >>> I need to create a macro which will look through word documents. The
> >>> macro will need to look for certain words which are (upper right,
> >>> upper left, bottom right and bottom left). These words will then
> >>> need to be replaced by some kind of autoshape/symbol.
> >>> Upper right would need to become |_
> >>> Upper left would need to become _|
> >>> Bottom right would need to become | with a line on the right hand
> >>> side (at the top)
> >>> Bottom left would need to become | with a line on the left hand side
> >>> (at the top)
> >>> The autoshape/symbol also needs to be active so the typist can type
> >>> in a number of 1-8 in the box, this is a dental grid. I know how to
> >>> record macros and i am happy finding and replacing words, but this
> >>> is proving quite difficult to achieve. Is there any sort of vb
> >>> script out there that will accomplish this, what is the best way to
> >>> get the end result. I am very new to VB so my knowledge is very
> >>> limited.
> >>> Any help would be very much appreciated. Thanks in advance
> >>>
> >>> lewisma
> >>>
> >>> lewisma
>
>
>
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> Document Management All times are: Eastern Time (US & Canada) (change)
Goto page 1, 2, 3, 4
Page 1 of 4

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET