LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Selecting drawing objects or shapes in a macro

I created a template where users may want to show two black boxes on the
page at any point. The sheet has to be printed two ways. Once plain
and once with these two black boxes which cover up the values in two
columns. I created buttons to turn these boxes "on" and "off." I
don't delete the boxes when the user wants to change them, I just have
a macro attached the buttons which change their color to white (or
transparent).

If you happen to create buttons to toggle your circles, you can right
click on the button, choose Format Control, and uncheck Print object
under the Properties tab. This way, the user can see the buttons at
all times, but they won't print.

I see you already know the name of your object. The only tricky part
about this is that.. if you protect the sheet, you have to make sure
that either object your are selecting to change is in an unlocked cell
OR you choose to allow the user to "Edit Objects." If you allow them
to edit objects, they could change the buttons on your form, but you
can always send them to another cell so that they don't even notice
they have this privilege. You need to go to your VB editor and create
a module under your project, then add this... to some extent. Then you
would have to go back to your sheet and attach the macros to your
buttons (if you're going to use buttons).

Your code would look like:


Code:
--------------------

Sub DotOff()

ActiveSheet.Shapes("Oval 26").Select
Selection.ShapeRange.Fill.Visible = msoFalse
Range("A10").Select

End Sub

Sub DotOn()

ActiveSheet.Shapes("Oval 26").Select
Selection.ShapeRange.Fill.Visible = msoTrue
Range("A10").Select

End Sub

--------------------



If you want to do something tricky like send the user back to whatever
range they were in... you'll have to assign their range to some
variable, then send them there afterwards. I'll let you figure that
one out. Its too early in the morning for me!



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

 
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
Excel 2007: Selecting multiple objects by drawing a selection box panalysis Excel Discussion (Misc queries) 4 April 2nd 23 07:41 PM
drawing shapes move when printing Barry_in_Oz Charts and Charting in Excel 2 October 5th 10 04:57 AM
selecting multiple objects with macro Memphus01 Excel Discussion (Misc queries) 3 December 2nd 08 07:30 PM
When drawing shapes in excel the shapes keep disappearing Tape Excel Discussion (Misc queries) 1 October 6th 06 04:23 PM
Drawing shapes in a chart ChadTarget Charts and Charting in Excel 1 September 21st 06 09:07 AM


All times are GMT +1. The time now is 04:07 PM.

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

About Us

"It's about Microsoft Excel"