Consulting

Results 1 to 6 of 6

Thread: Custom AutoFormatAsYouType

  1. #1
    VBAX Tutor lynnnow's Avatar
    Joined
    Jan 2005
    Location
    Mumbai, Maharashtra, India
    Posts
    299
    Location

    Custom AutoFormatAsYouType

    Hi,

    I have a find and replace macro that looks for specific symbols to format sentences as italics, bold, bold+italics, etc. This macro is executed from a button. I'm trying to upgrade the functionality to an AutoFormatAsYouType kind of function but with my custom symbols as it is used to create an HTML table with the specified formatting.

    Here is a sample for the italics formatting.
        Options.DefaultHighlightColorIndex = wdBrightGreen 
       With Selection.Find
            .ClearFormatting
            .Replacement.ClearFormatting
            .Replacement.Highlight = True
            With .Replacement.Font
                .Bold = False
                .Italic = True
            End With
            .Text = "^^*|"
            .Replacement.Text = ""
            .Forward = True
            .Wrap = wdFindAsk
            .Format = True
            .MatchCase = False
            .MatchWholeWord = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
            .MatchWildcards = True
        End With
    The Convert to HTML function uses a sequence of Replace functions looking for these custom symbols. Any help in pointing me in the right direction would help.

    Thanks in advance.

    Lynnnow

  2. #2
    VBAX Contributor
    Joined
    Jul 2020
    Location
    Sun Prairie
    Posts
    119
    Location
    Beyond my limited abilities, but I am certain that doing something like this as AutoFormat As You Type is going to be painfully intrusive and slow Word down. Consider, instead of vba, using straight AutoCorrect.

  3. #3
    VBAX Tutor lynnnow's Avatar
    Joined
    Jan 2005
    Location
    Mumbai, Maharashtra, India
    Posts
    299
    Location
    I'm not sure if AutoCorrect accepts asterisks as wildcards for replacing formatting. The length of the string between the symbols can vary from a few characters to even over a hundred characters, so only if AutoCorrect can identify the full string of characters between the symbols will it work. But, yes, I knew it was going to be a bit unreasonable developing something like this. I was thinking of using a hybrid technique with using asterisks and underscores to achieve the same result, will delve into looking in that direction since it is already available in Word.

  4. #4
    Banned VBAX Newbie
    Joined
    Oct 2023
    Posts
    2
    Location
    Quote Originally Posted by lynnnow View Post
    I'm not sure if AutoCorrect accepts asterisks as wildcards for replacing formatting. The length of the string between the symbols can vary from a few characters to even over a hundred characters, so only if AutoCorrect can identify the full string of characters between the symbols will it work. But, yes, I knew it was going to be a bit unreasonable developing something like this. I was thinking of using a hybrid technique with using asterisks and underscores to achieve the same result, will delve into looking in that direction since it is already available in Word.
    Have you tried using this method yet? Is it dino game effective?

  5. #5
    VBAX Tutor lynnnow's Avatar
    Joined
    Jan 2005
    Location
    Mumbai, Maharashtra, India
    Posts
    299
    Location
    Quote Originally Posted by Mira23 View Post
    Have you tried using this method yet? Is it dino game effective?
    Hi Mira,

    Unfortunately it is not for dino game (not even sure if you're referring to the Google dino game, sorry). I have quit looking for a solution for this query, however.

  6. #6
    Moderator VBAX Guru Aussiebear's Avatar
    Joined
    Dec 2005
    Location
    Queensland
    Posts
    4,999
    Location
    Mira23 was simply trying to spread spam, so has left the building.
    Remember To Do the Following....
    Use [Code].... [/Code] tags when posting code to the thread.
    Mark your thread as Solved if satisfied by using the Thread Tools options.
    If posting the same issue to another forum please show the link

Posting Permissions

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