I am dealing with two environments: simple text and tables. I thought that
instead of having two or more macros that do essentially the same thing with
one or two variations it would be easier to have one, provided you can hold
Shift (or other) and click on a customized toolbar button to run it. So, that
is where the difficulty lies, I am not dealing with forms or command buttons.
Along this line, is there a way you can customize your toolbar buttons, so
that when you click once, it does one thing and when you click twice, it does
another?
Appreciate your help.
vs
> Hi Staroslav,
>
[quoted text clipped - 10 lines]
> > right key terms. Can's seem to find what I need.
> > Thanks!
Helmut Weber - 26 Apr 2005 13:38 GMT
Hi Staroslav,
there is a new articel by Jay Freedman:
http://word.mvps.org/faqs/macrosvba/ModifyRecordedMacro.htm
containing a section on:
--- Making toggle macros
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Staroslav - 26 Apr 2005 14:05 GMT
Thanks Helmut,
I do make use of the toggle principle, but what I am asking is a toggle of a
slightly different character. When it is not possible to codify all of the
conditions, my decision is necessary. I am just trying to find ways to avoid
having my customized toolbar cluttered with buttons by employing mouse events
or button down events. Can it be done?
> Hi Staroslav,
>
[quoted text clipped - 9 lines]
> "red.sys" & chr(64) & "t-online.de"
> Word 2002, Windows 2000
Helmut Weber - 26 Apr 2005 14:56 GMT
Hi Staroslav
google for GetKeyState.
A very simple example:
Private Declare Function GetKeyState Lib "user32"
(ByVal vKey As Long) As Integer
Function ShiftState() As Integer
Const VK_SHIFT = &H10
Const VK_CONTROL = &H11
ShiftState = (Abs(GetKeyState(VK_SHIFT) < 0) * 1) + _
(Abs(GetKeyState(VK_CONTROL) < 0) * 2)
End Function
---
Sub TestKeyState()
MsgBox ShiftState
' ctrl = 2
' shift ctrl = 3 usw.
End Sub
Example covering all by Thomas Gahler:
http://tinyurl.com/8buvg
Partly in German, but doesn't matter.
Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
Staroslav - 30 Jun 2005 14:23 GMT
Helmut, thank you for your help. This is what I was looking for, but for the
life of me I cannot get it to work in a simple macro as the one below. How do
I intergrade your code so it would work? I tried everything I can think of,
but alas...
Sub CellUnderline()
'macro underlines a cell with a single 0.5pt width line if Shift key is down _
and 0.75pt if not
Selection.Cells(1).Select
With Selection.Borders(wdBorderBottom)
.LineStyle = wdLineStyleSingle
'If Shift_Is_Down Then
.LineWidth = wdLineWidth050pt
'Else
.LineWidth = wdLineWidth075pt
End With
End Sub

Signature
Greetings from Moscow, Russia
> Hi Staroslav
>
[quoted text clipped - 27 lines]
> "red.sys" & chr(64) & "t-online.de"
> Word 2002, Windows 2000