VB Keyboard in Word 97

S

Steelangel

Hi!

I'm a FORTRAN programmer at heart, so I'm a bit perplexed and newbis
about VB syntax.

My project is to create a userform that is a keyboard for extende
latin characters, to prevent me having to rememeber a hundred alt+xxx
commands. On that end, I have done pretty good for myself, using

Code
-------------------

Selection.TypeText Text:="x"

-------------------

I only have issues figuring out what to use for carriage returns an
backspaces.

I would also like for the form to allow for font selection and colo
assignment. I can create drop down menus with no problem, but I don'
know how to code the following algorithm:

0) Set font to 'y' and font color to 'z' in the drop down window.
1) Click button for character 'x'
2) Print 'x' to screen with font 'y' and font color 'z'

This seems to be a VB 101 problem, but I'm completely at a loss abou
it
 
J

Jonathan West

Hi Steelangel

Steelangel said:
Hi!

I'm a FORTRAN programmer at heart, so I'm a bit perplexed and newbish
about VB syntax.

My project is to create a userform that is a keyboard for extended
latin characters, to prevent me having to rememeber a hundred alt+xxxx
commands. On that end, I have done pretty good for myself, using

Code:

For carriage return, use this code

Selection.TypeParagraph

For a backspace, use this

Selection.TypeBackspace

I would also like for the form to allow for font selection and color
assignment. I can create drop down menus with no problem, but I don't
know how to code the following algorithm:

0) Set font to 'y' and font color to 'z' in the drop down window.
1) Click button for character 'x'
2) Print 'x' to screen with font 'y' and font color 'z'

This seems to be a VB 101 problem, but I'm completely at a loss about
it.

OK, suppose you have two comboboxes, one called FontList and the other
called ColorList.

The font list contains a list of font names. The color list should contain
the list of colors available in Word 97, in this specific order

Auto
Black
Blue
Turquoise
Bright Green
Pink
Red
Yellow
White
Dark Blue
Teal
Green
Violet
Dark Red
Dark Yellow
Grey 50%
Grey 25%

Then the button that you click for the character should call the following
routine

Private Sub SetFontAndColor()
Selection.Font.Name = FontList.Text
Selection.Font.ColorIndex = ColorList.ListIndex
End Sub

The reason that the colors must be in that order is that the values of the
ColorIndex property then match their order in the list, so that you can
assign the position of the selected item diectly as the value of the color.

After calling the SetFontAndColor routine, the button should insert the
appropiate character.
 

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

Similar Threads


Top