Help using With statement to move command buttons

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I'm trying to move the location of two command buttons by using a With
statement but am getting the error below. My code is also below. Any help
is appreciated!

Error: Run-time error 438: Object doesn't support this property or method.

Code:
With .Shapes("submemid")
.ShapeRange.Top = 18
.ShapeRange.Left = 153.75
End With
 
You may want to qualify .shape

How about something like

With ActiveSheet.Shapes("submemid")

I've worked with shapes in PowerPoint, but not Excel, so let me know if it
works as expected.

HTH,
Barb Reinhardt
 
Hi Barb,

I tried that - got the same error. Below is the code I tried:

Sheets("Member ID Report Input").Activate
With ActiveSheet.Shapes("submemid")
.ShapeRange.Top = 8
.ShapeRange.Left = 23.75
End With
With ActiveSheet.Shapes.Shapes("CommandButton1")
.ShapeRange.Top = 8
.ShapeRange.Left = 173.75
End With
 
I wonder if the shape names aren't really what you think they are. Try this:

Sub FindShape()
Dim myShape As Object
For Each myShape In ActiveSheet.Shapes
myShape.Select
Debug.Print myShape.Name, myShape.top, myshape.left
Next myShape
End Sub


Step through this so that you know what shape is being selected and what the
name is. That might help you figure out what's happening.

HTH,
Barb Reinhardt
 
With ActiveSheet.Shapes("submemid")
.Top = 18
.Left = 153.75
End With


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Thanks Bob and Barb for your help!
--
Robert


Bob Phillips said:
With ActiveSheet.Shapes("submemid")
.Top = 18
.Left = 153.75
End With


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top