none
Excel error 438 RRS feed

  • Question

  • Hey, 

    I have a piece of code written by an old colleague which I am having difficulty getting to run on one specific computer. This computer is throwing up a 438 error in excel. We're running several different OS but I have ensured that all relevant patches have been installed. The specific bit of code that it is highlighting as the issue reads as follows. Any hints would be fantastic, as I say it works on every other machine without fault. 

    Private Sub Worksheet_Calculate()
    Set wb = Workbooks("Condition reports V2.8.xlsm").Worksheets("Condition Report")
    If Range("Q12").Value = "NO" And Range("Q14").Value = "NO" Or Range("T14").Value = "YES" Then
    wb.CommandButton1.Enabled = True
    Else
    wb.CommandButton1.Enabled = False
    End If
    End Sub

    Any ideas as all? I know without context this code means little and less if it helps it is the "wb.CommandButton1.Enabled = True" part that seems to be causing the issue. 

    Cheers. 

    Wednesday, September 13, 2017 10:09 AM

All replies

  • Have you edited the workbook in any way? If you, perhaps, changed the commandbutton on the sheet from an ActiveX version to a Forms version? Run this with the file open, and see what message you get...

    Private Sub TestButton()
        Dim vOT As Variant
        On Error GoTo Err
        vOT = Workbooks("Condition reports V2.8.xlsm").Worksheets("Condition Report").CommandButton1.OLEType
        MsgBox "The commandbutton is the correct type."
        Exit Sub
    Err:
        MsgBox "The commandbutton is the wrong type."
    End Sub

    Wednesday, September 13, 2017 5:08 PM
  • Hi,

    Based on your description, I'll move your question to the MSDN forum for Excel developers:

    https://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev

    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.


    Regards,
    Emi Zhang
    TechNet Community Support

    Please remember to mark the replies as answers if they helped.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, September 14, 2017 2:11 AM
  • Hi Showell3135,

    if we try to find the error description then it is ,"object doesn't support this property or method".

    I try to make a test with your code.

    I find that I can also reproduce the issue in Excel 2016.

    I try various other approach but nothing works.

    wb.Shapes("CommandButton1").ControlFormat.Enabled = True    'not work
    
    wb.CommandButton1.Enabled = False    'not work
    
    CommandButton1.Enabled = True        'not work
    
    Dim b1 As Button
    Set b1 = wb.Buttons("CommandButton1")
    b1.Enabled = False                   'not work    
    
    
    Me.CommandButton1.Enabled            'not work  
    
    Sheets(1).CommandButton1.Enabled = False     'not work 
    
    ActiveSheet.Shapes.Item("CommandButton1").ControlFormat.Enabled = False       'not work 
    

    so it looks like something wrong with the Excel which not enabling /disabling the command button.

    Regards

    Deepak

      


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, September 14, 2017 9:20 AM
    Moderator
  • Hi Showell3135,

    I can see that the issue is related with enabling the command button.

    cause by the line below.

    wb.CommandButton1.Enabled = True

    below code is working on my side which enable / disable the button correctly.

    Sub demo2()
    With ActiveSheet.OLEObjects("CommandButton1")
        .Enabled = Not .Enabled
    End With
    End Sub

    Output:

    so you can try to replace the problematic line with the code above to solve the issue.

    Note: the same code will be use to enable and disable button. no any other code needed. if button is disable then it will be get enabled and vice versa.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, September 18, 2017 8:20 AM
    Moderator
  • Hi Showell3135,

    I can see that after creating this thread, you did not follow up this thread.

    Is your issue is solved now?

    if yes, I suggest you to post your code and mark it as an answer.

    if you issue is still exist then I suggest you to refer the suggestions given by the community members.

    if you still have any further questions regarding the same issue , let us know about that.

    we will try to provide you further suggestions to solve the issue.

    Thanks for your understanding.

    Regards

    Deepak


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, September 22, 2017 5:38 AM
    Moderator