![]() |
Help using With statement to move command buttons
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 -- Robert |
Help using With statement to move command buttons
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 "robs3131" wrote: 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 -- Robert |
Help using With statement to move command buttons
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 -- Robert "Barb Reinhardt" wrote: 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 "robs3131" wrote: 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 -- Robert |
Help using With statement to move command buttons
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 "robs3131" wrote: 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 -- Robert "Barb Reinhardt" wrote: 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 "robs3131" wrote: 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 -- Robert |
Help using With statement to move command buttons
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) "robs3131" wrote in message ... 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 -- Robert |
Help using With statement to move command buttons
Thanks Bob and Barb for your help!
-- Robert "Bob Phillips" wrote: 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) "robs3131" wrote in message ... 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 -- Robert |
All times are GMT +1. The time now is 01:49 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com