Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-12-2012, 08:48 AM
AndyDDUK AndyDDUK is offline URGENT VBA needed for placing image on page Windows 7 64bit URGENT VBA needed for placing image on page Office 2010 64bit
Advanced Beginner
URGENT VBA needed for placing image on page
 
Join Date: Oct 2012
Posts: 32
AndyDDUK is on a distinguished road
Default URGENT VBA needed for placing image on page

Hi
Can you make two amendments to the code below,if so it would be greatly appreciated?

1) so it places/aligns the bottom of the image so it is 11cm from the top
2) so instead of being 30% of the original size, it scales height to 171.5 and reduces width accordingly to scale

Full code as below:
Sub ATopLeft()
Dim oshp1 As Shape
Dim oshp2 As Shape
If ActiveWindow.Selection.ShapeRange.Count <> 2 Then Exit Sub
Set oshp1 = ActiveWindow.Selection.ShapeRange(1)
Set oshp2 = ActiveWindow.Selection.ShapeRange(2)
oshp1.Width = oshp1.Width * 0.30
oshp2.Width = oshp2.Width * 0.30
oshp1.Top = cm2Points(2)
oshp2.Top = cm2Points(2)
oshp2.Left = oshp1.Left + oshp1.Width
ActiveWindow.Selection.ShapeRange.Cut
With ActivePresentation.Slides(ActiveWindow.View.Slide. SlideNumber).Shapes.PasteSpecial(ppPastePNG)


.Left = cm2Points(7) - .Width / 2
.Top = cm2Points(6) - .Height / 2
.Top = cm2Points(10)
.Line.Visible = True
.Line.ForeColor.RGB = RGB(0, 176, 80)
.Line.Weight = 3
End With
End Sub


Cheers
Andy
Reply With Quote
  #2  
Old 11-12-2012, 09:48 AM
JohnWilson JohnWilson is offline URGENT VBA needed for placing image on page Windows 7 64bit URGENT VBA needed for placing image on page Office 2010 32bit
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,913
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Maybe

Code:
Sub ATopLeft()
Dim oshp1 As Shape
Dim oshp2 As Shape
If ActiveWindow.Selection.ShapeRange.Count <> 2 Then Exit Sub
Set oshp1 = ActiveWindow.Selection.ShapeRange(1)
Set oshp2 = ActiveWindow.Selection.ShapeRange(2)
oshp1.Height = 171.5
oshp2.Height = 171.5
oshp1.Top = oshp2.Top
oshp2.Left = oshp1.Left + oshp1.Width
ActiveWindow.Selection.ShapeRange.Cut
With ActiveWindow.View.Slide.Shapes.PasteSpecial(ppPastePNG)
.Left = cm2Points(7) - .Width / 2
.Top = cm2Points(11) - 171.5
.Line.Visible = True
.Line.ForeColor.RGB = RGB(0, 176, 80)
.Line.Weight = 3
End With
End Sub

Function cm2Points(inVal As Single) As Single
cm2Points = inVal * 28.346
End Function
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 11-12-2012, 09:54 AM
AndyDDUK AndyDDUK is offline URGENT VBA needed for placing image on page Windows 7 64bit URGENT VBA needed for placing image on page Office 2010 64bit
Advanced Beginner
URGENT VBA needed for placing image on page
 
Join Date: Oct 2012
Posts: 32
AndyDDUK is on a distinguished road
Default

Tried it and it looks good...thank you!!!
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
URGENT VBA needed for placing image on page Placing Image behind Text Box alexei_lg Word 1 02-07-2012 12:28 PM
URGENT VBA needed for placing image on page Urgent help needed sinrockz Office 3 08-19-2011 10:58 AM
URGENT VBA needed for placing image on page Corrupt word doc! URGENT HELP NEEDED!! 99nasha Word 1 03-11-2011 04:24 PM
Help-urgent help needed immediately munstershug PowerPoint 1 05-01-2010 11:27 AM
MS-Word 2003 Help Needed Urgent Karthik123 Word 10 01-26-2010 08:43 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:14 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft