On reshaping listbox on open

atf32

Board Regular
Joined
Apr 13, 2011
Messages
157
:confused: Problem working in 2003 and then saving with .mht extension (single file web page). I have a simple "On Open" procedure that is called upon to reshape a listbox.

=================================
Sub Resize_Objects()
'Resizes Listbox

On Error GoTo ERROR_Resize_Objects

Application.ScreenUpdating = False

ThisWorkbook.Sheets("Sheet1").Select

ThisWorkbook.ActiveSheet.Shapes("ListBox3").Select

With Selection.ShapeRange
.Height = 98
.Width = 152.25
End With

=================================

When workbook is opened as a .xls, the code works. When the file is opened as a .mht, it returns an error that tells me that "The item with the specified name wasn't found." (runtime error '-2147024809 (80070057))........BUT, if I stop the code and intiate manually, it runs fine.

Also the debug yellow line stops at the line "ThisWorkbook.ActiveSheet.Shapes("ListBox3").Select".

Any suggestions here?
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Forum statistics

Threads
1,224,603
Messages
6,179,856
Members
452,948
Latest member
UsmanAli786

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