LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Send Element to Back

If you have a shape already on the worksheet, you can get its name by
selecting it and then go into the VB editor and execute this line in the
Immediate Window....

? Selection.Name

Repeat the process if you have other existing shapes that you want to find
the names of. To draw a line into a worksheet, you would use the worksheet's
Shape object's AddLine method. As an example, this code...

Dim LineName As String
With Sheet1
.Shapes.AddLine 100, 100, 500, 500
LineName = .Shapes(.Shapes.Count).Name
End With
MsgBox LineName

will add a line at the indicated coordinates (see the help files for more on
the parameters) on Sheet1 and then display the name of the line in a
MessageBox. Dim the LineName variable outside of any procedure (or Dim it in
a Module depending on your scope requirements for it) to make it visible to
more than one procedure. To add a picture, use the Shape object's AddPicture
method (again, see the help files for its parameters).

--
Rick (MVP - Excel)


"natanz" wrote in message
...
Thank you so much for your reply. It is very helpful. I hope you can
help again by answering a follow-up question. How do i know the names
of the shapes in my spreadsheet? Is it the filename of the picture.
Is it assigned by excel when the shape is inserted or drawn. I have
two shapes i am dealing with, 1 picture inserted, and 1 line drawn.
Ultimately, I want to programmatically draw this line and insert this
picture as well as "arrange" it, any help or direction you can give me
on those tasks would be awesome also.

Thanks for your help.

Natan

On Dec 2, 4:32 pm, "Rick Rothstein"
wrote:
Just remembered... you wanted to send the picture to the back, not bring
it
to the front... use the SendToBack method instead of the BringToFront
method
that I showed in my previous message.

WS = "Sheet1"
SH = "Picture 1"
Worksheets(WS).Shapes(SH).OLEFormat.Object.SendToB ack

--
Rick (MVP - Excel)

"Rick Rothstein" wrote in message

...



Give this a try...


WS = "Sheet1"
SH = "Picture 1"
Worksheets(WS).Shapes(SH).OLEFormat.Object.BringTo Front


Change the sheet name and and shape name that are assigned to the WS and
SH variables to match your actual conditions.


--
Rick (MVP - Excel)


"natanz" wrote in message
...
I found a macro that helped me insert a picture (jpeg file) in an
excel spreadsheet. Now I am looking for a way to send that element in
back of other elements on the spreadsheet. I have tried to record a
macro to figure out the methods and procedures, but apparently the
"send to back" buttons and "bring to front" are invisible to the macro
recorder. I found that the insert/shape/line tools are also
invisible. Finding a way to draw a line would be equally effective,
because if it is drawn following the insert it will effectively be on
top, which will meet my needs.


i appreciate any help you can provide. Thanks.


Natan- Hide quoted text -


- Show quoted text -




 
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
Trying to move photo behind text. "Send back" doesn't work. Judy Excel Worksheet Functions 5 April 23rd 23 07:45 PM
Excel 2007-send Word Art text to back tinks Excel Discussion (Misc queries) 3 May 4th 09 06:20 PM
Rules for element-by-element product in array multiplication Paul Excel Programming 2 March 22nd 08 11:42 PM
how to send excel attachments which can be edited and sent back excel attachments Excel Discussion (Misc queries) 0 September 30th 05 03:38 PM
HOW TO send data to another program and get back results in Excel? Yong[_2_] Excel Programming 1 December 11th 04 01:54 AM


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