Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Steved
 
Posts: n/a
Default Automate this macro please.

Hello from Steved

The below macro is designed to run manually meaning to do a whole document i
push the macro button each time, is there something that can be added or
changed
to do the whole document please. I mean push the macro button and it
completes the total Document.

Sub LeftMargin()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.HomeKey Unit:=wdLine
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=8
Selection.TypeText Text:=" "
End Sub


Thankyou.

  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor
 
Posts: n/a
Default Automate this macro please.

What is the nature of the document and what is it that you are trying to do
with this macro?
Incidentally macro questions are best posted to one of the Word vba groups.

--

Graham Mayor - Word MVP

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


Steved wrote:
Hello from Steved

The below macro is designed to run manually meaning to do a whole
document i push the macro button each time, is there something that
can be added or changed
to do the whole document please. I mean push the macro button and it
completes the total Document.

Sub LeftMargin()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.HomeKey Unit:=wdLine
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=8
Selection.TypeText Text:=" "
End Sub


Thankyou.



  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Steved
 
Posts: n/a
Default Automate this macro please.

Hello Graham from Steved

I've 2 lines off information

The 1st line contains 1st: 2nd: all the way to 24th.

Thats is what is been deleted ( 1st: 2nd: all the way to 24th.)

The second line needs the delete button to be pushed 8 times to line up with
the line above. ( the line Ive just done the deleting )

Thankyou.

"Graham Mayor" wrote:

What is the nature of the document and what is it that you are trying to do
with this macro?
Incidentally macro questions are best posted to one of the Word vba groups.

--

Graham Mayor - Word MVP

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


Steved wrote:
Hello from Steved

The below macro is designed to run manually meaning to do a whole
document i push the macro button each time, is there something that
can be added or changed
to do the whole document please. I mean push the macro button and it
completes the total Document.

Sub LeftMargin()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.HomeKey Unit:=wdLine
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=8
Selection.TypeText Text:=" "
End Sub


Thankyou.




  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor
 
Posts: n/a
Default Automate this macro please.

Something seems to have got lost in the translation as I am even more
confused now than before. Can you paste a sample of the text into your
message and let us know what you want to do with that text. Forget the macro
for now. What exactly are you trying to do?

--

Graham Mayor - Word MVP

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


Steved wrote:
Hello Graham from Steved

I've 2 lines off information

The 1st line contains 1st: 2nd: all the way to 24th.

Thats is what is been deleted ( 1st: 2nd: all the way to 24th.)

The second line needs the delete button to be pushed 8 times to line
up with the line above. ( the line Ive just done the deleting )

Thankyou.

"Graham Mayor" wrote:

What is the nature of the document and what is it that you are
trying to do with this macro?
Incidentally macro questions are best posted to one of the Word vba
groups.

--

Graham Mayor - Word MVP

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


Steved wrote:
Hello from Steved

The below macro is designed to run manually meaning to do a whole
document i push the macro button each time, is there something that
can be added or changed
to do the whole document please. I mean push the macro button and it
completes the total Document.

Sub LeftMargin()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.HomeKey Unit:=wdLine
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=8
Selection.TypeText Text:=" "
End Sub


Thankyou.



  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Steved
 
Posts: n/a
Default Automate this macro please.

Hello from Steved

Looking at below if I delete 8th: the line below will need to be bought
back into line as show'n in the 2 examples below.

From This
8th: 1 PRIMARY 726269X42 ( 3) 57.0 S COLLINS 49.8 4 H

EEFFEE FG T( 8 0 3) F( 4 0 2) C( 1 0
0)
To this
1 PRIMARY 726269X42 ( 3) 57.0 S COLLINS 49.8 4 H
EEFFEE FG T( 8 0 3) F( 4 0 2) C( 1 0 0)

Thankyou.







"Graham Mayor" wrote:

Something seems to have got lost in the translation as I am even more
confused now than before. Can you paste a sample of the text into your
message and let us know what you want to do with that text. Forget the macro
for now. What exactly are you trying to do?

--

Graham Mayor - Word MVP

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


Steved wrote:
Hello Graham from Steved

I've 2 lines off information

The 1st line contains 1st: 2nd: all the way to 24th.

Thats is what is been deleted ( 1st: 2nd: all the way to 24th.)

The second line needs the delete button to be pushed 8 times to line
up with the line above. ( the line Ive just done the deleting )

Thankyou.

"Graham Mayor" wrote:

What is the nature of the document and what is it that you are
trying to do with this macro?
Incidentally macro questions are best posted to one of the Word vba
groups.

--

Graham Mayor - Word MVP

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


Steved wrote:
Hello from Steved

The below macro is designed to run manually meaning to do a whole
document i push the macro button each time, is there something that
can be added or changed
to do the whole document please. I mean push the macro button and it
completes the total Document.

Sub LeftMargin()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.HomeKey Unit:=wdLine
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=8
Selection.TypeText Text:=" "
End Sub


Thankyou.






  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor
 
Posts: n/a
Default Automate this macro please.

This appears to be a relatively straightforward wildcard search and replace
of
[0-9]{1,}[dhstr]{2}:[ ]@
with nothing. - http://www.gmayor.com/replace_using_wildcards.htm

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[0-9]{1,}[dhstr]{2}:[ ]@"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll


--

Graham Mayor - Word MVP

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



Steved wrote:
Hello from Steved

Looking at below if I delete 8th: the line below will need to be
bought back into line as show'n in the 2 examples below.

From This
8th: 1 PRIMARY 726269X42 ( 3) 57.0 S COLLINS 49.8 4 H

EEFFEE FG T( 8 0 3) F( 4 0 2)
C( 1 0 0)
To this
1 PRIMARY 726269X42 ( 3) 57.0 S COLLINS 49.8 4 H
EEFFEE FG T( 8 0 3) F( 4 0 2) C( 1 0 0)

Thankyou.







"Graham Mayor" wrote:

Something seems to have got lost in the translation as I am even more
confused now than before. Can you paste a sample of the text into
your message and let us know what you want to do with that text.
Forget the macro for now. What exactly are you trying to do?

--

Graham Mayor - Word MVP

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


Steved wrote:
Hello Graham from Steved

I've 2 lines off information

The 1st line contains 1st: 2nd: all the way to 24th.

Thats is what is been deleted ( 1st: 2nd: all the way to 24th.)

The second line needs the delete button to be pushed 8 times to line
up with the line above. ( the line Ive just done the deleting )

Thankyou.

"Graham Mayor" wrote:

What is the nature of the document and what is it that you are
trying to do with this macro?
Incidentally macro questions are best posted to one of the Word vba
groups.

--

Graham Mayor - Word MVP

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


Steved wrote:
Hello from Steved

The below macro is designed to run manually meaning to do a whole
document i push the macro button each time, is there something
that can be added or changed
to do the whole document please. I mean push the macro button and
it completes the total Document.

Sub LeftMargin()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.HomeKey Unit:=wdLine
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=8
Selection.TypeText Text:=" "
End Sub


Thankyou.



  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Steved
 
Posts: n/a
Default Automate this macro please.

Thankyou.

"Graham Mayor" wrote:

This appears to be a relatively straightforward wildcard search and replace
of
[0-9]{1,}[dhstr]{2}:[ ]@
with nothing. - http://www.gmayor.com/replace_using_wildcards.htm

Selection.HomeKey Unit:=wdStory
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = "[0-9]{1,}[dhstr]{2}:[ ]@"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = True
End With
Selection.Find.Execute replace:=wdReplaceAll


--

Graham Mayor - Word MVP

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



Steved wrote:
Hello from Steved

Looking at below if I delete 8th: the line below will need to be
bought back into line as show'n in the 2 examples below.

From This
8th: 1 PRIMARY 726269X42 ( 3) 57.0 S COLLINS 49.8 4 H

EEFFEE FG T( 8 0 3) F( 4 0 2)
C( 1 0 0)
To this
1 PRIMARY 726269X42 ( 3) 57.0 S COLLINS 49.8 4 H
EEFFEE FG T( 8 0 3) F( 4 0 2) C( 1 0 0)

Thankyou.







"Graham Mayor" wrote:

Something seems to have got lost in the translation as I am even more
confused now than before. Can you paste a sample of the text into
your message and let us know what you want to do with that text.
Forget the macro for now. What exactly are you trying to do?

--

Graham Mayor - Word MVP

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


Steved wrote:
Hello Graham from Steved

I've 2 lines off information

The 1st line contains 1st: 2nd: all the way to 24th.

Thats is what is been deleted ( 1st: 2nd: all the way to 24th.)

The second line needs the delete button to be pushed 8 times to line
up with the line above. ( the line Ive just done the deleting )

Thankyou.

"Graham Mayor" wrote:

What is the nature of the document and what is it that you are
trying to do with this macro?
Incidentally macro questions are best posted to one of the Word vba
groups.

--

Graham Mayor - Word MVP

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


Steved wrote:
Hello from Steved

The below macro is designed to run manually meaning to do a whole
document i push the macro button each time, is there something
that can be added or changed
to do the whole document please. I mean push the macro button and
it completes the total Document.

Sub LeftMargin()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.HomeKey Unit:=wdLine
Selection.Extend
Selection.Find.ClearFormatting
With Selection.Find
.Text = "^$:"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.Delete Unit:=wdCharacter, Count:=8
Selection.TypeText Text:=" "
End Sub


Thankyou.




Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Automate a mail merge in Word 2002 from a macro in Access 2002 Ed B Mailmerge 9 July 8th 05 04:31 PM
Macro Button Won't Stay on Toolbar caleb Microsoft Word Help 2 June 14th 05 11:59 PM
Possible bug when recording a Word Macro Raven95 Microsoft Word Help 4 April 30th 05 09:49 PM
Save As is not working due to macro security settings Craig Meritz Microsoft Word Help 1 December 16th 04 03:53 AM
2000 to 2002 macro and "Could not open macro storage" Art Farrell Mailmerge 1 December 6th 04 12:40 PM


All times are GMT +1. The time now is 07:41 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"