Results 1 to 6 of 6
  1. #1
    New Lounger
    Join Date
    Feb 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Convert Case of Variable (Word 2003)

    I use the following to insert a company name into a Word document from Outlook. How do I change the case of strProvider before inserting it? (I think I have seen this answer somewhere on the board before, but could not find it.)

    Dim strProvider As String
    strProvider = Application.GetAddress(AddressProperties:="<PR_COM PANY_NAME>")
    Selection.TypeText Text:=strProvider

  2. #2
    Silver Lounger
    Join Date
    Jul 2001
    Location
    Ottawa, Ontario, Canada
    Posts
    1,609
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Convert Case of Variable (Word 2003)

    I would try:
    strProvider = UCase(strProvider)
    Regards
    Don

  3. #3
    New Lounger
    Join Date
    Feb 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Convert Case of Variable (Word 2003)

    Actually I am going from all upper case to title case and just could not figure out how to it using the Case property the simplest way. I do know how to assign the variable contents to a bookmark and use the Case property to change the case in the bookmark, just trying to find something simpler.

    Thank you!

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Convert Case of Variable (Word 2003)

    To convert to proper case:

    ...
    Selection.TypeText Text:=StrConv(strProvider, vbProperCase)

    (I don't know of any Case property in the Word object model.)

  5. #5
    New Lounger
    Join Date
    Feb 2005
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Convert Case of Variable (Word 2003)

    Thank you Hans. Here is what I was looking at in the Word 2003 VB Help file:

    Case Property
    See AlsoPropertiesMethodsEventsSpecificsReturns or sets a WdCharacterCase constant that represents the case of the text in the specified range. Read/write.

    WdCharacterCase can be one of these WdCharacterCase constants.
    wdFullWidth
    wdHalfWidth
    wdHiragana
    wdKatakana
    wdLowerCase
    wdNextCase
    wdTitleSentence
    wdTitleWord
    wdToggleCase
    wdUpperCase

    expression.Case
    expression Required. An expression that returns a Range object.

    Remarks
    Some of the constants listed above may not be available to you, depending on the language support (U.S. English, for example) that you

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 28 Times in 28 Posts

    Re: Convert Case of Variable (Word 2003)

    Thanks, I don't know why I missed that. <img src=/S/stupidme.gif border=0 alt=stupidme width=30 height=30>

Posting Permissions

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