Results 1 to 7 of 7
  1. #1
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Uppercase one word in a string + questions (Word 2000 onwards)

    1. Select the word and press Shift+F3. Shift+F3 toggles between all lower case, title case (first letter upper case) and all upper case.

    2. I don't understand exactly what you want.

    3. Your code refers to an undefined variable or constant sDateFormat.

  2. #2
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Uppercase one word in a string + questions (Word 2000 onwards)

    Edited 11:43. New attachment added. Apologies for the error in the attachment.

    Hi

    Hope you guys can help me.

    1. How do I capitalise the first letter of a specific word in a string. For example, (abc to Abc), "The new product abc is ..." to "This new product Abc is ..."

    2. Is there a ways of letting word save a document without displaying any messages. I don't mean calling ActiveDocument.Save manually from within a macro. The problem with ActiveDocument.Save is that I would have to process the errors returned by the method .Save. I was thinking that if I just set ActiveDocument.Saved= False then let word do its work. But, I don't want it to display any messages on screen - e.g. asking for a filename. Anyway this is a minor point so don't worry too mucha about it.

    3. I have written a macro that works (woo hoo!) but would like your view on it. Is there a better of achieving the same results using perhaps built-in macros or something simpler? The macos takes a string (suppose to be a date in any date format including ddth Month yyyy) & produces the date in the format 'ddth Month yyyy". If rubbish is entered in the string then it doesn't take any action. Please forgive lack of comments.

    Thanks

    Robie
    Attached Files Attached Files
    Thanks.
    Robie

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Uppercase one word in a string + questions (Word 2000 onwards)

    Thanks for quick response Hans.

    1. I would like the replacement under VBA, if possible.
    2. Basically I do not want WORD to display any messages on the screen yet deal with any error codes returned by the save process. For example, if the user has switched on the 'Warn before printing, saving and sending a file that contains tracked changes or comments' option then I would like Word to deal with that. The problem is that if I manually call ActiveDocument.Save then I need to know that the error code returned by WORD for the above option is actually NOT an error but continue with save.
    3. Apologies for the error in the attachment. It was a constant.

    Thanks

    Robie.
    Thanks.
    Robie

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

    Re: Uppercase one word in a string + questions (Word 2000 onwards)

    1. You could use

    Dim strSomething As String
    ...
    strSomething = ...
    ...
    strSomething = Replace(strSomething, "abc", "Abc")

    2. Try

    Application.DisplayAlerts = wdAlertsNone
    ActiveDocument.Save
    Application.DisplayAlerts = wdAlertsAll

    3. And what is the value of that constant?

  5. #5
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Uppercase one word in a string + questions (Word 2000 onwards)

    1. Thanks
    2. Thanks
    3. Sorry, The value is: "dd mmmm yyyy". BTW: I updated the attachment with the value. Apologies for missing it out earlier.

    Thanks once again.

    Robie
    Thanks.
    Robie

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

    Re: Uppercase one word in a string + questions (Word 2000 onwards)

    Instead of repeated If Then Else statements, you could simply replace "th", "rd" etc. with an empty string:

    IssueDate = Replace(IssueDate, "th", "")
    IssueDate = Replace(IssueDate, "rd", "")
    ...

  7. #7
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    London, Gtr London, England
    Posts
    416
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Uppercase one word in a string + questions (Word 2000 onwards)

    Thanks Thanks Thanks Thanks. You are great Hans.
    Thanks.
    Robie

Posting Permissions

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