Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Donate Today!

Do you enjoy these
technical forums?
Donate Today! Click Here

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Changing font color of text in word using Basic macro

outlet (Programmer) (OP)
3 Jun 05 23:11
Can anyone help with this??  I use hummingbird 6.0 editor, using hummingbird basic.  I have a macro that interfaces with billing software, checks port status and prints out the final report in a word doc.  I have the word object declared and everything works fine, except I can't change the font color, on specific lines of text, in the final product.  Any suggestions???
johnwm (Programmer)
4 Jun 05 2:47
If you're using anything like VBA then try setting a BookMark to the part you want to change fontcolor, then use:

    Selection.GoTo what:=wdGoToBookmark, Name:="bm2"   
   Selection.Font.Color = wdColorRed

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts

outlet (Programmer) (OP)
5 Jun 05 16:27
It's more Basic than VB.  Here is how the MS Word object is created:

Dim WBO As Object     'Declare WBO as object
Set WBO = CreateObject("Word.Basic")        
WBO.AppShow           'show the word doc
WBO.FileNewDefault    'Default file name assigned by word

The line of text I want to change the font color on is contained in an array called Heading1$():

Heading1$(x) = "ERROR KEY:"

The code that inserts the text into the word doc is:

WBO.FONT "Courier"
WBO.FontSize 12
WBO.FONT "Bold"
WBO.Insert Heading1$(x)  +Chr$(10) 'inserts text & return
 

I've tried the following code without success:

WBO.FONT "Red"
WBO.FontColor "Red" 'this line creates compiler object error

Any ideas????   Anyone??  The Hummingbird Basic Workbench for Windows NT 6.1 editor being used only has options for Font type, style & size.  There is no option for color.  Do I have to open a specific word document, then kick off an internal macro in that doc to change the font color??
           

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close