+ Reply to Thread
Results 1 to 8 of 8

Replace MsgBox with WScript.Shell.PopUp

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Replace MsgBox with WScript.Shell.PopUp

    I have an userform that gives the user a message in the string UserMessage.

    UserMessage = " added"
    I want to replace the MsgBox with the UserMessage to a ("WScript.Shell").PopUp message that should disappear after 1 second.

    CreateObject("WScript.Shell").PopUp UserMessage & " added", 1
    This code gives me the following output " added" where as I would like to see "UserMessage added".

  2. #2
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    Re: Replace MsgBox with WScript.Shell.PopUp

    CreateObject("WScript.Shell").PopUp "UserMessage" & " " & "added", 1
    ???

  3. #3
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: Replace MsgBox with WScript.Shell.PopUp

    Hi nigelog, your answer works perfectly! Thank you!

  4. #4
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    Re: Replace MsgBox with WScript.Shell.PopUp

    Glad to help

    I am now trying to change the Caption of the PopUp away from Windows Script Host

  5. #5
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: Replace MsgBox with WScript.Shell.PopUp

    Please post here if you succeed in changing the caption!

  6. #6
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    Re: Replace MsgBox with WScript.Shell.PopUp

    This works to display ERROR! as the caption

    CreateObject("WScript.Shell").PopUp "Enter 0 ", 1, "ERROR!!"

  7. #7
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Sweden
    MS-Off Ver
    2016.
    Posts
    397

    Re: Replace MsgBox with WScript.Shell.PopUp

    It works great. I did see however that mystring UserMessage gets passed as text and not as a string.

    It says "UserMessage added".

    Say UserMessage is nigelog, then I want it to say "nigelog added".

    CreateObject("WScript.Shell").PopUp UserMessage & " " & "added.", 1, "Added "

  8. #8
    Forum Expert nigelog's Avatar
    Join Date
    12-14-2007
    Location
    Cork, Ireland
    MS-Off Ver
    Office 365 Windows 10
    Posts
    2,293

    Re: Replace MsgBox with WScript.Shell.PopUp

    I don't quite get where you are going with this but if you want the user name then

    Sub Popup()
    CreateObject("WScript.Shell").Popup Application.UserName & " " & "added", 1, "Item Added"
    End Sub
    Finally got what you were saying
    Sub Popup()
    Dim UserMessage As String
    
    UserMessage = "My addition was"
    
    CreateObject("WScript.Shell").Popup UserMessage & " " & "added", 1, "Item Added"
    End Sub
    Last edited by nigelog; 08-23-2018 at 11:11 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Timer not always working [timeout in WScript.Shell Popup method]
    By MrMyagiii in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-17-2018, 03:02 AM
  2. WScript.Shell error 'Outside Procedure'
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-22-2017, 06:43 AM
  3. [SOLVED] WScript.Shell Not Working Under Excel 2013
    By yossicadaner in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2014, 10:55 AM
  4. Replies: 2
    Last Post: 01-03-2013, 04:32 PM
  5. [SOLVED] CreateObject("WScript.Shell").Popup
    By MyComputerGuy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-14-2012, 09:18 AM
  6. Replies: 4
    Last Post: 05-07-2012, 07:13 PM
  7. using WScript.CreateObject("Wscript.Shell
    By John Keith in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-30-2005, 02:20 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1