Consulting

Results 1 to 12 of 12

Thread: How insert emphasis for selection character

  1. #1
    VBAX Regular
    Joined
    Aug 2007
    Posts
    66
    Location

    How insert emphasis for selection character

    Hi. How can insert acute accent for selection of character into word?
    For example, I inserting acute accent like this:
    Selection.InsertSymbol Font:="Times New Roman", CharacterNumber:=769, Unicode:=True
    But it replace my selection character. If I add:
    Selection.Collapse direction:=wdCollapseEnd
    that nothing do

    There is screenshot that show what I want: http://img.photobucket.com/albums/v1...n/toaccent.gif
    or http://img.photobucket.com/albums/v1...toaccent-2.gif

    acute accent is diacritical mark.
    Last edited by akokin; 09-11-2007 at 03:00 AM.

  2. #2
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,286
    Location
    - type your letter ?
    - directly push the keys shift and left arrow
    - push the keys shift and F3
    - push right arrow

    or you could try this macro[vba]Sub accent_e_to_accent_E()
    Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
    Selection.Range.Case = wdNextCase
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    End Sub[/vba]or[VBA]Sub o_accent()
    Selection.TypeText Text:="?"
    End Sub[/VBA]

  3. #3
    VBAX Regular
    Joined
    Aug 2007
    Posts
    66
    Location
    Quote Originally Posted by Charlize
    - type your letter ?
    - directly push the keys shift and left arrow
    - push the keys shift and F3
    - push right arrow
    ...
    Thank you but it not that I want. I want to insert acute accent (or to accent or emphasis). That you suggested is letter case.

  4. #4
    VBAX Regular
    Joined
    Aug 2007
    Posts
    66
    Location
    OK. I did it. That code:
    Selection.MoveRight Unit:=wdCharacter, Count:=1
    Selection.InsertSymbol CharacterNumber:=769, Unicode:=True

  5. #5
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    If I understand correctly ...

    Unicode character 301 (decimal 769) is the combining acute accent.

    If you want one by itself use U+00B4 (decimal 180) instead.
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  6. #6
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Looks like I didn't understand - and still don't
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

  7. #7
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Neither do I. Why are you adding (or combining as Tony mentions) an accent? For example, why are you adding the accent to the "E" of "YELLOW"??????

  8. #8
    VBAX Regular
    Joined
    Aug 2007
    Posts
    66
    Location
    I have put an accent sign on Y but probably was mistaken.

  9. #9
    VBAX Regular
    Joined
    Aug 2007
    Posts
    66
    Location
    Ok. I have next code:
    Sub accent() 
    Dim selChar As Long 
    selChar = AscW(Selection.Range.Characters(1)) 
    If Selection.Type = wdSelectionIP Then 
       MsgBox prompt:="Nothing selection", Title:="Select a character" 
    Else 
    ' How delete accent mark? Check here.
       With Selection 
        .Collapse direction:=wdCollapseEnd 
        .InsertSymbol CharacterNumber:=769, Unicode:=True 
       End With 
    End If 
    End Sub
    Now I want delete Character (769) from selection text (if it exist).
    How I can delete it?
    Thank you!

  10. #10
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    I am not following this at all. You ask how to add the accent, now you are asking how to delete it?

    What are you doing???????

  11. #11
    VBAX Regular
    Joined
    Aug 2007
    Posts
    66
    Location
    Quote Originally Posted by fumei
    I am not following this at all. You ask how to add the accent, now you are asking how to delete it?

    What are you doing???????
    Sorry if I confused you. I just wanted to get solution that first set accent and then delete it (for selection text). I solved this problem:
    Sub accent2()
    Dim rAcc As Range
    Dim rTmp As Range
    Set rTmp = Selection.Range
    If Selection.Type = wdSelectionIP Then
       MsgBox prompt:="Selection not found", Title:="Check"
    ElseIf Len(rTmp) = 2 Then
       For Each rAcc In rTmp.Characters
          If AscW(Right(rAcc, 1)) = 769 Then
             rAcc = Left(rAcc, 1)
          End If
       Next rAcc
    Else
       Selection.Collapse direction:=wdCollapseEnd
       Selection.InsertSymbol characternumber:=769, unicode:=True
    End If
    End Sub
    Thank you very much.

  12. #12
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Ummm

Posting Permissions

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