Refer to a shape properties located in other sheet

drom

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

I Do not have to select the Shape to get the following info:
VBA Code:
Dim shp As Object:                Set shp = Sheets(1).Shapes("pImgModel")

Debug.Print shp.Placement
Debug.Print shp.Left
Debug.Print shp.Top
Debug.Print shp.Width
Debug.Print shp.Height

If I select the shape, I can get this info:

VBA Code:
Dim shp As Object:                Set shp = Sheets(1).Shapes("pImgModel")
                                  shp.Select
With Selection
Debug.Print .ShapeRange.LockAspectRatio
Debug.Print .ShapeRange.Line.ForeColor.ObjectThemeColor
Debug.Print .ShapeRange.Line.Visible
Debug.Print .ShapeRange.Line.ForeColor.TintAndShade
Debug.Print .ShapeRange.Line.ForeColor.Brightness
Debug.Print .ShapeRange.Line.Transparency
End With

'But Is it possible to get the prior info without selecting the shape?
(because my activesheet is gonna be Sheets(6)​
I do not want to move from sheets(6) to Sheets(1) and go back to Sheets(6)​


This way does not work:
VBA Code:
Dim shp As Object:                Set shp = Sheets(1).Shapes("pImgModel")
With shp
Debug.Print .ShapeRange.LockAspectRatio
Debug.Print .ShapeRange.Line.ForeColor.ObjectThemeColor
Debug.Print .ShapeRange.Line.Visible
Debug.Print .ShapeRange.Line.ForeColor.TintAndShade
Debug.Print .ShapeRange.Line.ForeColor.Brightness
Debug.Print .ShapeRange.Line.Transparency
End With



Thanks again !
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Declare it as Shape not Object & then you can use
VBA Code:
Debug.Print .LockAspectRatio
Debug.Print .Line.ForeColor.ObjectThemeColor
Debug.Print .Line.Visible
Debug.Print .Line.ForeColor.TintAndShade
Debug.Print .Line.ForeColor.Brightness
Debug.Print .Line.Transparency
 
Upvote 0
Solution

Forum statistics

Threads
1,217,376
Messages
6,136,198
Members
449,998
Latest member
jpaul123

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