View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
robs3131 robs3131 is offline
external usenet poster
 
Posts: 144
Default Enabled property failing when code tries to set it

Thanks for your input. The shapes are command buttons. What I find strange
is that the following code does work. Any idea on why this code works and my
initial code does not?

Dim sh As Worksheet

'Select Main Menu, hide all other sheets, and protect Main Menu
Sheets("Main Menu").Visible = xlSheetVisible
Sheets("Main Menu").Select
For Each sh In ActiveWorkbook.Sheets
If sh.Name < "Main Menu" Then
sh.Visible = xlVeryHidden
Else
End If
Next
Sheets("Main Menu").Activate
Sheets("Main Menu").linksalesin.Enabled = False
Sheets("Main Menu").linksaleshis.Enabled = False
Sheets("Main Menu").cjsalesin.Enabled = False
Sheets("Main Menu").cjsaleshis.Enabled = False
Sheets("Main Menu").perfsalesin.Enabled = False
Sheets("Main Menu").perfsaleshis.Enabled = False
Sheets("Main Menu").linkpayin.Enabled = False
Sheets("Main Menu").linkpayhis.Enabled = False
Sheets("Main Menu").cjpayin.Enabled = False
Sheets("Main Menu").cjpayhis.Enabled = False
Sheets("Main Menu").perfpayin.Enabled = False
Sheets("Main Menu").perfpayhis.Enabled = False
Sheets("Main Menu").intierdata.Enabled = False
Sheets("Main Menu").commdetrpt.Enabled = False
Sheets("Main Menu").transclearbyaff.Enabled = False
Sheets("Main Menu").viewtransclearbyaff.Enabled = False
Sheets("Main Menu").cmdarchive.Enabled = False
Sheets("Main Menu").cmdclearall.Enabled = False
Sheets("Main Menu").cmdlinktiemerch.Enabled = False
Sheets("Main Menu").perfopeninvoices.Enabled = False

--
Robert


"Dave Peterson" wrote:

Shapes don't have a .enabled property.

Some shapes can be enabled/disabled this way:
shap.OLEFormat.Object.Enabled = False

Some shapes can't be enabled or disabled.

You may want to be more specific in your code and your question about the shapes
that you're using.




robs3131 wrote:

Hi all,

I'm getting the error below for the code below for the line that is preceded
by '***' - I don't understand why this property cannot be set for this
variable. Any input is greatly appreciated!

Error:

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

Code:

Dim sh As Worksheet
Dim shap

'Select Main Menu, hide all other sheets, and protect Main Menu
Sheets("Main Menu").Visible = xlSheetVisible
Sheets("Main Menu").Select
For Each sh In ActiveWorkbook.Sheets
If sh.Name < "Main Menu" Then
sh.Visible = xlVeryHidden
Else
End If
Next
Sheets("Main Menu").Activate
For Each shap In ActiveSheet.Shapes
*** shap.Enabled = False
Next shap

--
Robert


--

Dave Peterson