Results 1 to 4 of 4

Thread: Macro creation

  1. #1
    2 Star Lounger
    Join Date
    Jun 2001
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I am trying to create macro that will insert quotes italicized and wait for me to type the text between the quotes. What I have works fine, however, I do not know how to “turn off” the italics feature after the close quotes.

    The idea is that “it gives quotes, then insertion point here, which is OK” but this text is not supposed to be italicized, which is not OK.

    I am always trying to create little macros to do things like this but I do not have enough knowledge to write good macros. Still working on it . It is much easier for me to press ALT+J instead of CTRL+I, quote, type text, quote, and then CTRL+I again, continue typing.

    This is what I have

    Sub MVG_MakeItalics()
    ' Macro recorded 6/24/2009 by Maria
    ' Attached to ALT+J
    ' Selection.Font.Italic = wdToggle
    Selection.TypeText Text:=""
    Selection.Font.Italic = wdToggle
    Selection.TypeText Text:=""""" "
    Selection.Font.Italic = wdToggle
    Selection.MoveLeft Unit:=wdCharacter, Count:=2
    End Sub

    Any help greatly appreciated, like always.

    Thank you.

  2. #2
    Plutonium Lounger
    Join Date
    Nov 2001
    Posts
    10,550
    Thanks
    0
    Thanked 7 Times in 7 Posts
    There's probably many more elegant ways to do this, but this will work.
    Code:
    	
    	  Selection.Font.Italic = True
    	  Selection.TypeText """"""
    	  Selection.Font.Italic = False
    	  Selection.TypeText " "
    	  Selection.Move Unit:=wdCharacter, Count:=-2

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Try

    Code:
    Sub MVG_MakeItalics()
      ' Macro recorded 6/24/2009 by Maria
      ' Attached to ALT+J
      Selection.TypeText Text:=""""" "
      ActiveDocument.Range(Selection.Start - 3, Selection.Start - 1).Font.Italic = True
      Selection.MoveLeft Unit:=wdCharacter, Count:=2
    End Sub
    You'll have to move the insertion point after the space when you've typed the text.

  4. #4
    2 Star Lounger
    Join Date
    Jun 2001
    Posts
    103
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='HansV' post='781554' date='24-Jun-2009 22:28']Try

    Code:
    Sub MVG_MakeItalics()
      ' Macro recorded 6/24/2009 by Maria
      ' Attached to ALT+J
      Selection.TypeText Text:=""""" "
      ActiveDocument.Range(Selection.Start - 3, Selection.Start - 1).Font.Italic = True
      Selection.MoveLeft Unit:=wdCharacter, Count:=2
    End Sub
    You'll have to move the insertion point after the space when you've typed the text.[/quote]
    Thank you. Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •