Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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 | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Automate a mail merge in Word 2002 from a macro in Access 2002 | Mailmerge | |||
Macro Button Won't Stay on Toolbar | Microsoft Word Help | |||
Possible bug when recording a Word Macro | Microsoft Word Help | |||
Save As is not working due to macro security settings | Microsoft Word Help | |||
2000 to 2002 macro and "Could not open macro storage" | Mailmerge |