2

I want to display long message in MsgBox (more then 1024 characters). What method can i use. I found this:

Dim objShell As Object
Set objShell = CreateObject("Wscript.Shell")

Can You tell me are there any methods to achieve this? Maybe someone know better solution or disadvantages of using Wscript.Shell??

Oh, and one more thing, I want to add this code to an add-in i've created and which I want to distribute to othet coworkers..

tomek198823
  • 115
  • 2
  • 11
  • `WScript.Shell` is an object which can be used to run other applications. What give you the idea that it has anything to do with MsgBox? . You're going to need to include links to where you got this example and some relevant code, rather than a "wish list"! Also check out the [help/on-topic] as well as "[ask]" and also learn about aa [mcve]". – ashleedawg Jun 29 '18 at 05:55
  • 1
    `objShell.Run "mshta.exe vbscript:close(CreateObject(""WScript.shell"").Popup(""" & MessageBody & """," & SecondsToAutoClose & ",""" & MessageTitle & """))"` will allow you to pop a msgbox like window while not pausing the macro. But not checked about limit of characters. – PatricK Jun 29 '18 at 06:20
  • @PatricK I was searching for that code. `449` character max – TinMan Jun 29 '18 at 06:31

1 Answers1

2

So create a Form that looks like a MsgBox:

enter image description here

I used a TextBox instead of a Label and set the back colour to grey. I also specified for the TextBox scroll property to "Vertical Scrollbar" so if the text exceeds the viewable limit you'll be able to scroll.

Feel free to set the TextBox border property to Not Set, it's read-only property to True and add a MsgBox picturebox for a more authentic look.

Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
  • @tomek198823 if you want to give it to co-workers to use you might prefer to add the code as a . Net DLL, method 3 here: https://stackoverflow.com/questions/37074533/how-to-call-net-methods-from-excel-vba – Jeremy Thompson Jun 29 '18 at 07:36