Fix Form Size Relative to picture file to false

drom

Well-known Member
Joined
Mar 20, 2005
Messages
540
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and Thanks in advace!

I am trying to insert a PDF file in a excel file (no problem)
Once the PDF file is inserted I will fix it in a range Top, Left, Wiwdth...

But First I am using trhis Macro

VBA Code:
Sub Macro01()
On Error Resume Next: Application.ScreenUpdating = False​
Dim wPDF_File As String: wPDF_File = "D:\MyFiles\File 001 2024_Page_021.pdf"​
ActiveSheet.Shapes("aaAAaaAAaaAA").Delete​
Range("B2").Select​
ActiveSheet.OLEObjects.Add(Filename:=wPDF_File , Link:=False, DisplayAsIcon:=False).Select​

ActiveSheet.Shapes(ActiveSheet.Shapes.Count).Name = "aaAAaaAAaaAA"​
Dim SHP As Shape: Set SHP = ActiveSheet.Shapes("aaAAaaAAaaAA")​
SHP.Locked = False​
SHP.LockAspectRatio = msoFalse​
SHP.RelativeToOriginalSize = msoFalse 'This does NOt work
SHP.Placement = xlMoveAndSize​
SHP.PrintObject = True​

End Sub

Everything works FINE but:
SHP.RelativeToOriginalSize = msoFalse
How can I fix the Relative to picture size to be False ???
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
According to LINK The RelativeToOriginalSize arg doesn't control whether or not aspect ratio is maintained when scaling, it only specifies the reference, or "starting size" for the scaling operation.
Anyway I would like to know how can I fix it from VBA for a Shape
 
Upvote 0

Forum statistics

Threads
1,221,418
Messages
6,159,790
Members
451,589
Latest member
Harold14

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top