Computer Forum Forum Index
Register  FAQ Profile Log in to check your private messages Log in Register 

Need Word Macro Help Please
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Computer Forum Forum Index -> word vba customization
View previous topic :: View next topic  
Author Message
Jean-Guy Marcil
Guest





PostPosted: Sun Apr 29, 2007 2:27 am    Post subject: Re: Need Word Macro Help Please Reply with quote

Alan B. Densky was telling us:
Alan B. Densky nous racontait que :

Quote:
Hi Jean-Guy,

What I'm saying is that the start and end markers are strings of text
that I don't want to copy to the clipboard. They are there for the
sole purpose of making the macro universal so that it will work with
every article that I create.

I understood that part, I was just asking if the start tag was always
followed by a ¶, in which case it should also be removed from the text to be
copied as it would not serve any purpose once the tag is removed.

Here's the code you can use:

'_______________________________________
Set oRg = ActiveDocument.Range

'Select the range of text to copy to the clipboard
With oRg.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "(Article With Back links)(*)(END NO LINKS SECTION======2)"
.Replacement.Text = ""
.Forward = True
.Format = False
.MatchWildcards = True
.Wrap = wdFindContinue
.Execute
With .Parent
.MoveStart wdWord, 4
.MoveEnd wdWord, -6
.Copy
End With
End With
'_______________________________________

If the start tag is always followed by a ¶, change
.MoveStart wdWord, 4
by
.MoveStart wdWord, 5

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Back to top
Google
Sponsor





PostPosted: Sun Apr 29, 2007 2:27 am    Post subject: Advertisement

Back to top
Alan B. Densky
Guest





PostPosted: Sun Apr 29, 2007 4:44 am    Post subject: Re: Need Word Macro Help Please Reply with quote

Hi,

Yes, it is always followed by a ¶. In any case, the macro is now perfect.
Thank you very much for all of your help.

I'm actually an MS Access/VBA programmer with 14 years of experience. And
besides being out of my element with Word, one of the things that made it
difficult for me is that I couldn't find any info on the web to help me with
this particular problem.

Since this is probably a one time thing, I wasn't going to spend $50.00 on a
book to learn how to program Word. I felt like it was 1993 and I was
learning Access from scratch again. I didn't even know what to try to look
up then.

Again, thanks for your kind assistance.

Alan



"Jean-Guy Marcil" <DontEvenTry@NoSpam> wrote in message
news:%23BXn7XgiHHA.3412@TK2MSFTNGP02.phx.gbl...
Quote:
Alan B. Densky was telling us:
Alan B. Densky nous racontait que :

Hi Jean-Guy,

What I'm saying is that the start and end markers are strings of text
that I don't want to copy to the clipboard. They are there for the
sole purpose of making the macro universal so that it will work with
every article that I create.

I understood that part, I was just asking if the start tag was always
followed by a ¶, in which case it should also be removed from the text to
be copied as it would not serve any purpose once the tag is removed.

Here's the code you can use:

'_______________________________________
Set oRg = ActiveDocument.Range

'Select the range of text to copy to the clipboard
With oRg.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "(Article With Back links)(*)(END NO LINKS SECTION======2)"
.Replacement.Text = ""
.Forward = True
.Format = False
.MatchWildcards = True
.Wrap = wdFindContinue
.Execute
With .Parent
.MoveStart wdWord, 4
.MoveEnd wdWord, -6
.Copy
End With
End With
'_______________________________________

If the start tag is always followed by a ¶, change
.MoveStart wdWord, 4
by
.MoveStart wdWord, 5

--

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org
Back to top
The Harbour School
Guest





PostPosted: Tue Jun 12, 2007 4:39 pm    Post subject: Re: Need Word Macro Help Please Reply with quote

On 4/28/07 10:27 PM, in article #BXn7XgiHHA.3412@TK2MSFTNGP02.phx.gbl,
"Jean-Guy Marcil" <DontEvenTry@NoSpam> wrote:

Quote:
Alan B. Densky was telling us:
Alan B. Densky nous racontait que :

Hi Jean-Guy,

What I'm saying is that the start and end markers are strings of text
that I don't want to copy to the clipboard. They are there for the
sole purpose of making the macro universal so that it will work with
every article that I create.

I understood that part, I was just asking if the start tag was always
followed by a ¶, in which case it should also be removed from the text to be
copied as it would not serve any purpose once the tag is removed.

Here's the code you can use:

'_______________________________________
Set oRg = ActiveDocument.Range

'Select the range of text to copy to the clipboard
With oRg.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "(Article With Back links)(*)(END NO LINKS SECTION======2)"
.Replacement.Text = ""
.Forward = True
.Format = False
.MatchWildcards = True
.Wrap = wdFindContinue
.Execute
With .Parent
.MoveStart wdWord, 4
.MoveEnd wdWord, -6
.Copy
End With
End With
'_______________________________________

If the start tag is always followed by a ¶, change
.MoveStart wdWord, 4
by
.MoveStart wdWord, 5
kjuuuuity7it
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Computer Forum Forum Index -> word vba customization All times are GMT
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot 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
Computer Forum