[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Bold the last word in vb

Posted on 2007-03-26
8
Medium Priority
?
193 Views
Last Modified: 2010-04-30
I know this will bold the last line:

myDOc.Sentences.Last.Bold = True

How can I bold the last "word"
0
Comment
Question by:al4629740
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
8 Comments
 
LVL 32

Expert Comment

by:Daniel Wilson
ID: 18799458
Is this in MS Word?  What version?
0
 

Author Comment

by:al4629740
ID: 18800031
yes, ms word 2003
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 18800887
myDOc.Sentences.Words(myDOc.Sentences.Words.count-1).Bold = True
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 26

Assisted Solution

by:EDDYKT
EDDYKT earned 600 total points
ID: 18800893
myDOc.Sentences.Last.Words(myDOc.Sentences.Last.Words.count-2).Bold = True
0
 

Author Comment

by:al4629740
ID: 18802620
I get "data member not found.."  Why is this happening?
0
 

Author Comment

by:al4629740
ID: 18948856
I tried:
myDOc.Words.Last.Bold = True

But it does not do anything.  Why Not?????
0
 
LVL 32

Accepted Solution

by:
Daniel Wilson earned 900 total points
ID: 18949710
How many carriage returns or page breaks do you have after your "last" word?

Trying EDDYKT's script above, I found that it worked right when I had a return after my last word.  When I deleted that return the next-to-last word was what was bolded.  

I find that myDoc.Words.Last evaluates to a return.  What's working for me is:
ThisDocument.Words.Item(ThisDocument.Words.Count - 1).Bold = True
   
(Besides EDDYKT's code).
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question