Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default How to draw a object and erase it programmatically

I want to draw a rectangle with a circle programmatically and then I
want to erase and draw the rectangle and circle at a different place
on the worksheet.

Appreciate if somebody can share the code segment for a routine for
this.

Thanks
Simon
  #2   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 4
Default How to draw a object and erase it programmatically

Take a test sheet, start recording macro, do what you are trying to do, stop
recording, read the code


"Simon Lenn" wrote in message
om...
: I want to draw a rectangle with a circle programmatically and then I
: want to erase and draw the rectangle and circle at a different place
: on the worksheet.
:
: Appreciate if somebody can share the code segment for a routine for
: this.
:
: Thanks
: Simon


  #3   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 11,272
Default How to draw a object and erase it programmatically

Sim on,

The macro recorder gives it

Dim myshape As Shape

Set myshape = ActiveSheet.Shapes.AddShape(msoShapeRectangle, 165#,
255.75, 192.75, 91.5)
myshape.Name = "My Rectangle"
Set myshape = ActiveSheet.Shapes.AddShape(msoShapeOval, 436.5, 333#,
67.5, 66.75)
myshape.Name = "My Circle"

and

With ActiveSheet
.Shapes("My Rectangle").Delete
.Shapes("My Circle").Delete
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Simon Lenn" wrote in message
om...
I want to draw a rectangle with a circle programmatically and then I
want to erase and draw the rectangle and circle at a different place
on the worksheet.

Appreciate if somebody can share the code segment for a routine for
this.

Thanks
Simon



  #4   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 2,824
Default How to draw a object and erase it programmatically

You may want to group the circle and rectangle and instead of deleting, just
move them.

You could even add them multiple times and then toggle the visibility.



Simon Lenn wrote:

I want to draw a rectangle with a circle programmatically and then I
want to erase and draw the rectangle and circle at a different place
on the worksheet.

Appreciate if somebody can share the code segment for a routine for
this.

Thanks
Simon


--

Dave Peterson

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
want to erase the 0 Darrell_Sarrasin via OfficeKB.com Excel Discussion (Misc queries) 4 September 16th 08 03:24 PM
erase page #1 momma Excel Discussion (Misc queries) 1 August 29th 07 09:34 PM
Erase & Draw Border functions no longer work bob m Excel Discussion (Misc queries) 2 February 25th 05 06:03 PM
Draw object pasted into Excel cannot be deleted or moved Elaine Merchant Excel Discussion (Misc queries) 0 January 7th 05 09:35 PM
Programmatically adding buttons to a worksheet (Shape Object) Phil Excel Programming 3 January 26th 04 03:51 PM


All times are GMT +1. The time now is 01:32 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"