Question About Borders and Shading Dialog Box

J

JBNewsGroup

Hi,

In a WORD2000 macro I have the following code:

With Dialogs(wdDialogFormatBordersAnd Shading)
.Display
TBorderStyle = .TopStyle
LBorderStyle = .LeftStyle
BBorderStyle = .BottomStyle
RBorderStyle = .RightStyle
End With

I am not using "Show" as further down the macro I apply the selections to a
Shape which may not be selected or drawn at the time I use the Borders
dialog.

Question:

When the Dialog opens the Default setting is "None". How do you set the
Default setting to "Box" so that "Box" is selected when the Dialog opens?

Also, does anyone know what the arguments TL2BRBorder, etc are?

Any help is appreciated.

Thanks in advance for any replies.

Jerry Bodoff
 
J

Jay Freedman

Hi Jerry,

The "Setting" column down the left side of the dialog doesn't have a
corresponding argument. Each button there is a "preset" for a
collection of border styles, purely for use in the UI. The only way to
get it selected on open is to fake the Alt+X keystroke by putting the
statement

SendKeys "%x"

before the .Display statement.

If the Selection is in a table when the dialog opens (so the Apply To
box is set to either Table or Cell), buttons become visible to insert
the two diagonals: top left to bottom right (TL2BR) and top right to
bottom left (TR2BL). Each of those has a style, color, and weight (but
I don't know what the "border" value means).
 
J

JBNewsGroup

Hi Jay,

Thanks for your response. I will put in the SendKeys statement.

I assume that I could use SendKeys for any condition similar to this.

Jerry Bodoff
 
J

Jay Freedman

Hi Jerry,

In theory, yes, you can use it. In practice, SendKeys has a reputation
for flakiness. Sometimes the keystrokes go off into the ether, and
sometimes they get routed to the wrong window. It often doesn't work
in single-step mode (F8) in the editor but the same code will work if
you just launch the macro (F5).

You're generally safe if the SendKeys is *immediately* followed by the
..Show or .Display statement, which is best assured by using the colon
as a statement separator like this:

With Dialogs(wdDialogWhatever)
SendKeys "%a" : .Display
End With

I also try to keep the number of keystrokes in the SendKeys argument
to the bare minimum. Sacrificing a chicken under a full moon may help,
too. :)
 
J

JBNewsGroup

Hi Jay,

Thanks for your comments. It works fine.

Also, the "chicken ritual" helped.

Jerry Bodoff
 

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