Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / February 2008

Tip: Looking for answers? Try searching our database.

setting 2 different style on same line

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Grenier - 15 Feb 2008 14:14 GMT
I'm automating a Word report with Access. How can I set 2 different style on
a single line of text. Ex:

Enterprise:       Name of enterprise

"Enterprise:" sould be in style1 and "name of enterprise" in style 2
.TypeText Text:="Enterprise:" & vbTab & rst!EnterpName

Merci !
Jean-Guy Marcil - 15 Feb 2008 21:10 GMT
> I'm automating a Word report with Access. How can I set 2 different style on
> a single line of text. Ex:
[quoted text clipped - 3 lines]
> "Enterprise:" sould be in style1 and "name of enterprise" in style 2
> .TypeText Text:="Enterprise:" & vbTab & rst!EnterpName

Without knowing why you need two styles, it is difficult to offer any advice.
But, have you considered using character styles?
Grenier - 17 Feb 2008 21:51 GMT
Main reason is to be able to do a table of content with the name of
enterprise. Since I posted a figured out a way by using a table in witch
cell(1,1) style is set to 'normal bold' and cell(1,2) style is set to "Title
1".  Table border is set to color white just to hide it. Have not been able
to find another way but it's doing the job.

Merci !

--------------------------------
Without knowing why you need two styles, it is difficult to offer any advice.
But, have you considered using character styles?
---------------------------------------
I'm automating a Word report with Access. How can I set 2 different style on
a single line of text. Ex:

Enterprise:       Name of enterprise

"Enterprise:" sould be in style1 and "name of enterprise" in style 2
.TypeText Text:="Enterprise:" & vbTab & rst!EnterpName
Jean-Guy Marcil - 18 Feb 2008 13:36 GMT
> Main reason is to be able to do a table of content with the name of
> enterprise. Since I posted a figured out a way by using a table in witch
> cell(1,1) style is set to 'normal bold' and cell(1,2) style is set to "Title
> 1".  Table border is set to color white just to hide it. Have not been able
> to find another way but it's doing the job.

Glad to read that you have found a solution to your problem.

Just so you know, in case you need this at a later date... There is a way to
build a TOC by using only certain words.

Insert TC fields next to the text you want to use in the TOC (Insert >
Fields), then build a simple TOC using the \f switch: {TOC \f}.

You can also mix the type of TOC (based on TC fields and/or based on outline
level styles or paragraph styles). When inserting the TC fields, specify the
TOC level you want : {TC Some text \l 2} (this a lower case "L"). Then use
regular paragraph styles like Heading 1 to 9 and use the \o switch in the
TOC, or even use your own styles and add the \t switch. You could end up with
a TOC field like this one:

   {TOC \t "MyTOC2 Style,2,MYTOC3 Style,3" \o \f}

(Depending on your regional settings in Windows, you might need ";" instead
of "," in the \t switch definition.)
Grenier - 18 Feb 2008 13:55 GMT
Merci Jean-Guy pour vos bons commentaires c'est très apprécié.
Jean-Francois Grenier. Qc Can.

> > Main reason is to be able to do a table of content with the name of
> > enterprise. Since I posted a figured out a way by using a table in witch
[quoted text clipped - 21 lines]
> (Depending on your regional settings in Windows, you might need ";" instead
> of "," in the \t switch definition.)
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.