setting 2 different style on same line

G

Grenier

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 !
 
J

Jean-Guy Marcil

Grenier said:
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

Without knowing why you need two styles, it is difficult to offer any advice.
But, have you considered using character styles?
 
G

Grenier

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
 
J

Jean-Guy Marcil

Grenier said:
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.)
 
G

Grenier

Merci Jean-Guy pour vos bons commentaires c'est très apprécié.
Jean-Francois Grenier. Qc Can.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top