Consulting

Results 1 to 5 of 5

Thread: Run time 424 object required

  1. #1
    VBAX Regular
    Joined
    Nov 2018
    Posts
    21
    Location

    Run time 424 object required

    can someone please tell me why i am getting an error with this code and how to fix it?
    Run time 424 object required

    Sub but()strTitle = ""
    strText = "Would you like to enter another unit"
    Set YesNo = WScript.CreateObject("WScript.Shell")
    intType = vbYesNo
    Set YesNo = WScript.CreateObject("WScript.Shell")
    intResult = YesNo.Popup(strText, 3, strTitle, intType)
    Select Case intResult
    
    
        Case vbYes
    Sheet1.Select
        Case vbNo
            WScript.Echo "You clicked ""No""!"
       End Select
    End Sub

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    VBA or VBScript?

    VBA I'd use MsgBox

    Option Explicit
    
    
    Sub but()
        Dim strTitle As String, strText As String
        Dim intResult As VbMsgBoxResult
        
        strTitle = ""
        strText = "Would you like to enter another unit"
        intResult = MsgBox(strText, vbQuestion + vbYesNo, strTitle)
        
        Select Case intResult
            Case vbYes
                Sheet1.Select
        Case vbNo
            MsgBox "You clicked ""No""!", vbInformation + vbOKOnly, strTitle
       End Select
    End Sub
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    VBAX Regular
    Joined
    Nov 2018
    Posts
    21
    Location
    i need it to be VBscript to timeout the window in instance the user forget to click a button

  4. #4
    VBAX Regular
    Joined
    Nov 2018
    Posts
    21
    Location
    i figured it out


    come to realize it didnt like the WScript.CreateObject("WScript.Shell") had to change it to CreateObject("WScript.Shell")

  5. #5
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,728
    Location
    Quote Originally Posted by Me00550 View Post
    i need it to be VBscript to timeout the window in instance the user forget to click a button
    FWIW I've found the pop up timeout to be unreliable

    One of many articles

    https://stackoverflow.com/questions/31141775/infobox-popup-refuses-to-close-on-timer-expiration



    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •