Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drawing a rectangle from VB code...

Status
Not open for further replies.

ftpdoo

Programmer
Aug 9, 2001
202
GB
I've recorded a macro to draw a rectangle and the code looks as follows:

ActiveDocument.Shapes.AddShape(msoShapeRectangle, 547.55, 268.55, 72#, 45#).Select

but this won't work when pasted into the VB application. It throws an error "out of range"...

Any idea's??

Jonathan
 
Hi!

According to the help files, the last four numbers are all supposed to be Single data type. That being the case the first two shouldn't have decimals and the pound sign in the last two shouldn't be there. All four are, in order, width, heighth, position left and position top and all are measured in points (1/72 of an inch). From that you can figure out if it is going off of your form which needs to be at least 8.5" wide and 4.75" high.

hth
Jeff Bridgham
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top