Solved

Bold the last word in vb

Posted on 2007-03-26
8
184 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 26

Assisted Solution

by:EDDYKT
EDDYKT earned 200 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 300 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now