Sizing a Form Control

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I have a control toolbox command button in a protected form. When inserted
the height property is 24 and the width property is 72. The control is
formatted as a floating shape.

When I run the following code the control is not visible in the form:

Sub HideResetCommand()
Dim oCtr
Set oCtr = ActiveDocument.Shapes(1)
oCtr.OLEFormat.Object.Caption = ""
oCtr.OLEFormat.Object.Width = 0
oCtr.OLEFormat.Object.Height = 0
End Sub

The following code makes the control visible again in the form:

Sub ShowResetCommand()
Dim oCtr
Set oCtr = ActiveDocument.Shapes(1)
oCtr.OLEFormat.Object.Caption = "Reset Form"
oCtr.OLEFormat.Object.LockAspectRation = False
oCtr.OLEFormat.Object.Height = 24
oCtr.OLEFormat.Object.Width = 72
End Sub

Here is the proble. The control appears 72 picas high and 72 picas wide.
If I change the order of the height and width commands above then the
control appears as 24 picas high and 24 picas wide.

There is no intellisense with the .Object so I am at a loss as to what
command line I need.

Thanks.

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


.


Quantcast