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: 5,600
Default shape objects, displaying text, extra info??

What you've got sounds pretty neat. Expanding on both Tom's & Nick's
suggestions -

Sub Test()
Dim obj As Object, s As String

For Each obj In ActiveSheet.DrawingObjects

With obj
With .TopLeftCell
s = .Left & ":" & .Top
End With
s = .Name & vbLf & s & ":" & .Width & ":" & .Height
End With

If TypeName(obj) = "Rectangle" Or TypeName(obj) = "TextBox" Then
obj.Text = s
obj.OnAction = ThisWorkbook.Name & "!myMacro"
End If

Next

End Sub

Sub myMacro()
Dim sCaller As String, sPrompt As String
Dim obj As Object
Dim v

sCaller = Application.Caller
Set obj = ActiveSheet.DrawingObjects(sCaller)

sPrompt = "Replace text" & vbCr & "enter a # for a new line"
v = Application.InputBox(sPrompt, sCaller)

If Len(v) And Not v = False Then
#If VBA6 Then
v = Replace(v, "#", vbLf)
#Else
v = Application.WorksheetFunction.Substitute(v, "#", vbLf)
#End If
obj.Text = v
End If

End Sub

Sub OtherStuff()
ActiveSheet.Rectangles.OnAction = ThisWorkbook.Name & "!myMacro"

ActiveSheet.TextBoxes.Text = "hello" ' assumes already got Texboxes
' or to delete all text .Text = ""

'.Font will fail applying to +70 textboxes in one go
'loop or faster to make arrays of say 50 tb's, apply font to each array
ActiveSheet.TextBoxes.Font.Size = 8
ActiveSheet.TextBoxes.Font.ColorIndex = 5

End Sub

Regards,
Peter T


"IMAFriend" wrote in message
oups.com...
Okay, I am trying to convert a bunch of data into a bunch of images. I
decided to use rectangles, because.. well, because that's what the data
represents.

Imagine a jigsaw puzzle, (but all just solid rectangles of different
sizes).

So, my code works pretty well. It draws approximately 4000 rectangles
on the screen in various locations, colors, and whatnot. They do not
overlap, and they do not leave any 'white space'.

Is there a way I can assign some text, or other information, to each
rectangle?


Maybe there is someway I can still use that same built-in text block
within the shape, but when I click on a shape, the text goes into the
status bar, or a popup, or a 'callout'?

I think I can figure out how to add the desired text into the shape.
But...

Can anyone offer some direction on how I can take that text out? Based
on a mouseover, or a click, or arrow keys?

TIA,
DougB



 
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
displaying objects Soccerboy83 Excel Discussion (Misc queries) 3 September 17th 09 01:18 AM
How can I rotate objects in draw without changing shape? oldgunnersmate New Users to Excel 1 October 17th 08 07:21 PM
How do I add an extra pointer to a callout shape? gearhead Excel Discussion (Misc queries) 1 February 1st 07 05:04 PM
Select Multiple Shape Objects Alan Excel Programming 0 November 24th 04 06:25 AM
Comparing worksheets (extra info) Mark Excel Programming 0 April 9th 04 08:26 PM


All times are GMT +1. The time now is 10:31 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"