Error 438?! Not sure how to fix it...

ieJasonW

New Member
Joined
Mar 4, 2010
Messages
31
I'm trying to run a macro but I'm getting a run-time error - and it highlights the If..Then statement in the following code. Anyone know what its talking about when the error says "Object doesn't support this property or method"?

Thanks in advance for any help,

ieJason W

Here's the code:

Function Flag(x As Shape)
Dim outputcounter As Integer
Dim shpe As Shape
Dim Section As String
Dim WellboreParameter As String
Dim FutureFormationDamage As String
Dim ChemicalSelection As String

Set shpe = x

If shpe = ActiveSheet.Shapes("Carbonate") Or _
shpe = ActiveSheet.Shapes("PotassicSS") Or _
shpe = ActiveSheet.Shapes("IronSS") Or _
shpe = ActiveSheet.Shapes("SwellingSS") Or _
shpe = ActiveSheet.Shapes("MobileSS") Or _
shpe = ActiveSheet.Shapes("HgInFormation") Or _
shpe = ActiveSheet.Shapes("HighTemp") Or _
shpe = ActiveSheet.Shapes("LowTemp") Or _
shpe = ActiveSheet.Shapes("OilWet") Then
Section = WellboreParameter
End If
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
You need to evaluate some property of the shpe object.
Either of these should fly for you.

Code:
If shpe.Name = "Carbonate" Or _
shpe.Name = "PotassicSS" Or _
shpe.Name = "IronSS" Or _
shpe.Name = "SwellingSS" Or _
shpe.Name = "MobileSS" Or _
shpe.Name = "HgInFormation" Or _
shpe.Name = "HighTemp" Or _
shpe.Name = "LowTemp" Or _
shpe.Name = "OilWet" Then
Section = WellboreParameter
End If

Or...(this ones a little redundant)
Code:
If shpe.Name = ActiveSheet.Shapes("Carbonate").Name Or _
shpe.Name = ActiveSheet.Shapes("PotassicSS").Name Or _
shpe.Name = ActiveSheet.Shapes("IronSS").Name Or _
shpe.Name = ActiveSheet.Shapes("SwellingSS").Name Or _
shpe.Name = ActiveSheet.Shapes("MobileSS").Name Or _
shpe.Name = ActiveSheet.Shapes("HgInFormation").Name Or _
shpe.Name = ActiveSheet.Shapes("HighTemp").Name Or _
shpe.Name = ActiveSheet.Shapes("LowTemp").Name Or _
shpe.Name = ActiveSheet.Shapes("OilWet").Name Then
Section = WellboreParameter
End If

HTH

-TC-
 
Upvote 0
Perfect. That cleared it right up!

I have a hard time understanding the excel object model related portions of the help files. :( Thanks for the help. :)

ieJasonW
 
Upvote 0
Object Explorer in the IDE is goood. 'Help' took a step backwards with Office 2007. Fortunately Google has picked up their slack as far as examples go.
 
Upvote 0

Forum statistics

Threads
1,214,832
Messages
6,121,847
Members
449,051
Latest member
excelquestion515

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