From: Mark on 15 Feb 2010 02:12 Jay, Your 2 macros also do what I asked for (as did Doug's macro). I did have to play around a little with the the count for the for the paragraph and character in the last 2 lines of each code (I have a tab after the number). What I meant by saying that there was no easy way to select a variable amount of text, was that I could not do this using the macro recorder in Word just using Word commands. I assumed that there was an easy way to do this with VBA programming but I am too much of a novice to figure it out. Thanks for your help, Mark
From: Mark on 15 Feb 2010 02:15 Macropod, I did try to use find and replace using format but it would select stuff above my selection and text that I had already typed. It may be my lack of expertise in formatting but I could not make that work. Thanks, Mark
From: Jay Freedman on 15 Feb 2010 08:13 Mark, The macro recorder in Word is very limited compared to what you can do by writing VBA from scratch. In this case, though, you can get the equivalent of my first macro by recording the use of the Extend command (F8), which is less well-known than it should be. After inserting the # character and positioning the cursor, turn on the recorder and enter these keystrokes: F8 # Del Ctrl+down arrow (twice) Ctrl+right arrow (three times) The macro I get from this is: Sub Macro1() ' ' Macro1 Macro ' Macro recorded 2/15/2010 by Jay Freedman ' Selection.Extend Selection.Extend Character:="#" Selection.Delete Unit:=wdCharacter, Count:=1 Selection.MoveDown Unit:=wdParagraph, Count:=2 Selection.MoveRight Unit:=wdWord, Count:=3 End Sub -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. On Sun, 14 Feb 2010 23:12:01 -0800, Mark <Mark(a)discussions.microsoft.com> wrote: >Jay, > >Your 2 macros also do what I asked for (as did Doug's macro). I did have to >play around a little with the the count for the for the paragraph and >character in the last 2 lines of each code (I have a tab after the number). > >What I meant by saying that there was no easy way to select a variable >amount of text, was that I could not do this using the macro recorder in Word >just using Word commands. I assumed that there was an easy way to do this >with VBA programming but I am too much of a novice to figure it out. > >Thanks for your help, > >Mark
First
|
Prev
|
Pages: 1 2 Prev: Pass control name from Access to Word and save text in the con Next: Macros get disconnected |