Wrox Programmer Forums
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old February 17th, 2004, 02:10 PM
Registered User
Join Date: Jan 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default drawing with VBA

How can I draw a rectangle in VBA?

Old February 19th, 2004, 07:22 PM
Authorized User
Join Date: Feb 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts

You'll have to instance and work with the line object. Something like this:
    With myWS
        'Draw the distance axis
        With .Shapes.AddLine(Xmin, Ymin, Xmin, Ymax).Line
            .EndArrowheadStyle = msoArrowheadTriangle
            .EndArrowheadLength = msoArrowheadLengthMedium
            .EndArrowheadWidth = msoArrowheadWidthMedium
            .Weight = 3#
        End With
    End With
will draw a single line that has an arrow head. You will need to pass it the four points to draw your rectangle. You could also use a polyline or "shape" and pass its ordinates.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Drawing using Access VBA kirkgomez Access VBA 0 July 29th, 2006 10:42 PM
Drawing Shapes cbulutlar Javascript 2 March 6th, 2006 02:25 PM
drawing fergo Access VBA 0 June 6th, 2005 12:35 PM
drawing fergo BOOK: Access 2003 VBA Programmer's Reference 1 June 5th, 2005 09:32 AM
Drawing in C# stripytiger VS.NET 2002/2003 4 August 25th, 2004 10:01 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.