|
-
Jun 29th, 2009, 06:21 AM
#1
Thread Starter
Junior Member
[RESOLVED] [Powerpoint 2007] Apply "Send to back" to shape
Hi,
How do I apply 'Send to back' to a shape via macro code?
Thanks in advance.
-
Jun 29th, 2009, 06:46 AM
#2
Re: [Powerpoint 2007] Apply "Send to back" to shape
vb Code:
'~~> Replace "Rectangle 2" with the name of the relevant shape ActiveWindow.Selection.SlideRange.Shapes("Rectangle 2").Select ActiveWindow.Selection.ShapeRange.ZOrder msoSendToBack
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Jun 29th, 2009, 06:59 AM
#3
Thread Starter
Junior Member
Re: [Powerpoint 2007] Apply "Send to back" to shape
Hi Koolsid! Thanks for the code.
I tried to combine it with
ActiveWindow.Selection.SlideRange.Shapes.AddPicture FileName:=filnavn, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=640, Top:=158
like this
ActiveWindow.Selection.SlideRange.Shapes.AddPicture FileName:=filnavn, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=640, Top:=158, ZOrder:=msoSendToBack
But it doesn't work.
How can I combine the two pieces of code?
-
Jun 29th, 2009, 07:02 AM
#4
Re: [Powerpoint 2007] Apply "Send to back" to shape
Is that the only shape in that window?
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Jun 29th, 2009, 07:04 AM
#5
Thread Starter
Junior Member
Re: [Powerpoint 2007] Apply "Send to back" to shape
No, there are several other shapes.
-
Jun 29th, 2009, 07:07 AM
#6
Re: [Powerpoint 2007] Apply "Send to back" to shape
Well, you need to know the name of the shape so that you can select it via code and send it to the back...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Jun 29th, 2009, 07:15 AM
#7
Thread Starter
Junior Member
Re: [Powerpoint 2007] Apply "Send to back" to shape
How do I then set the name of my shape when I execute this piece of code?
ActiveWindow.Selection.SlideRange.Shapes.AddPicture FileName:=filnavn, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=640, Top:=158
Thanks for your help.
-
Jun 29th, 2009, 07:17 AM
#8
Re: [Powerpoint 2007] Apply "Send to back" to shape
Try this... See if this helps... Remember this will only work if there is no other shape at the same co-ordinates. If there are then you might need to select different parameters...
vb Code:
Sub Shps() Dim Shp As Shape, ShpName As String '~~> Sample. Change this as per your requirement filnavn = "C:\Documents and Settings\abhishek.shah\Desktop\koolsidz.gif" ActiveWindow.Selection.SlideRange.Shapes.AddPicture _ FileName:=filnavn, LinkToFile:=msoTrue, _ SaveWithDocument:=msoTrue, Left:=640, Top:=158 '~~> This will give you the names of all the shapes in that slide For Each Shp In ActivePresentation.Slides(1).Shapes '~~> An alternative that I can think of is to check '~~> the left and top of the shape and then get's it name '~~> and then send it to the back for example If Shp.Left = 640 And Shp.Top = 158 Then ShpName = Shp.Name Exit For End If Next '~~> Select Shape ActiveWindow.Selection.SlideRange.Shapes(ShpName).Select '~~> Send it to the back ActiveWindow.Selection.ShapeRange.ZOrder msoSendToBack End Sub
Hope this helps...
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Jun 29th, 2009, 07:40 AM
#9
Thread Starter
Junior Member
Re: [Powerpoint 2007] Apply "Send to back" to shape
I ended up using your code this way:
Code:
'find shape name
For Each Shp In ActivePresentation.Slides(ActiveWindow.View.Slide.SlideIndex).Shapes
If Shp.Left = 640 And Shp.Top = 158 Then
ShpName = Shp.Name
Exit For
End If
Next
'send arrow to back
ActiveWindow.Selection.SlideRange.Shapes(ShpName).Select
ActiveWindow.Selection.ShapeRange.ZOrder msoSendToBack
Thank you very much for your help!
-
Jun 29th, 2009, 07:53 AM
#10
Addicted Member
Re: [RESOLVED] [Powerpoint 2007] Apply "Send to back" to shape
If you're trying to move a shape that you have added via code to the back, then you don't need to loop. Just capture the shape into a variable when you add it:
vb Code:
Dim oShape As Shape
Set oShape = ActiveWindow.Selection.SlideRange.Shapes.AddPicture(FileName:=filnavn, LinkToFile:=msoTrue, SaveWithDocument:=msoTrue, Left:=640, Top:=158)
oShape.ZOrder msoSendToBack
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|