VBScript: Sometimes the msgbox message text is just ... Blank. (??)

Isaac

Lifelong Learner
Local time
Today, 01:32
Joined
Mar 14, 2017
Messages
9,911
I've given my users (and myself) a desktop shortcut. The shortcut points to a .vbs vbscript file on the network (full UNC path referenced). I know the network connection is fine, because 1) the shortcut's custom icon is visible, which resides on the network, and 2) the whole VBScript file works just fine - with the exception of this one very strange and perplexing oddity.

About 20% of the time, the msgbox (which is right at the top of the vbscript - first line of executable code) - simply fails to display the message. It just has the 'OK' button. Users don't mind terribly, they trust me and simply click OK, since that's the only button/option I've given them.

Any idea why ????

Here is the VBScript - up to the point of the msgbox.

Code:
'present a message box so that the user knows "something" is happening with this vbscript
'make sure the user has a folder in their appdata, to hold the database
'copy the latest network file into that folder
'open that file

dim strAppDataFolder, strFullPathToDatabaseFolder, fso, AccessApp

msgbox "Press OK to open the [name redacted] Database",vbInformation,"  "

(Google wasn't much help to me. No matter how I thought to try wording the search terms, the results were totally irrelevant)
 
Last edited:
I noticed that your question has yet to receive a reply. I have bumped it up the list so that it gets a second shot!
 
I have the exact same issue...and I am as dumbfounded as you as to why. It is completely outside of any loops, If statements , etc.

On of the reasons I am contemplating PowerShell.
 
Isn't it the weirdest thing ever? I've always known I ought to add powershell to my repertoire. I've been too lazy to put the time in so far

Go for it
 
I was hoping for "Hey John, allow ME to write it for you so I can learn!!"
 
Ha sorry. I've rubbed shoulders with a number of guys who used PS instead of VBS, but I've never come across a really specific and big reason why it's better (although there may be) so never had the motivation. If PS was easier to debug or step through that would be one. Then again, I think there are programs you can use to debug a vbscript, just never used one
 
Last edited:
Those timeout popups are 'purt cool. I wonder if there is a way to do that in Access...
And there is:


Code:
Public Sub PopUp
    Dim objShell as Object
    Set objShell = VBA.CreateObject("WScript.Shell")
  
    objShell.PopUp "AWF rocks!", 1 ' TIMEOUT parameter in seconds'
  
    Set objShell = Nothing
End Sub
 
Last edited:
Just saw this - yes indeed, that's very cool @Gasman , thanks for sharing. I never knew that. It's interesting that most of the parameters and constant values seem to mirror the Msgbox (which is what I used rather than wscript.echo).

Next time I need to do this I'll switch to this new method, try it out. TY !
 
I have limited experience of course, but I've already run into flakiness with MsgBoxes when I use the verbose form of the parameter settings (such as vbOK, vbInformation) instead of enumeration. I realize that the typical delineation involves early/late binding, but my unscientific feeling is that sometimes it doesn't resolve correctly giving strange weird errors.

Specifically related to PS and MsgBoxes, in my Googling it appears the "easiest" way to replicate that functionality is actually to load the VisualBasic libraries and use those! So, you'd be switching to PS and then dealing with VB anyway! You CAN use Windows Forms and System Displays with PS. So, that is powerful. However, as with most powerful tools, the overhead for doing so is deemed overkill for a simple message box. The flip side would be that once you had your overkill powershell messagebox function defined, you could drop it at the top of your script and call as needed. If you were REALLY feeling your Wheaties, you could use .NET or C# to program your own MsgBox cmdlet and then all of the Powershell kingdom would rejoice....yay! :ROFLMAO:
 
That's interesting. Add this to the list of things I might try (using the numeric value) if I ever wake up feeling like solving this problem - right now they aren't even using it, my evidence suggests they haven't used it since August. I guess they are busy in this season, unfortunately, we wanted the database used ("Reconciliation") in order to benefit us NOW - and NOW is here, but Reconciliation wasn't done :(

Powershell sounds fun.
 
Regarding the initial question: When you supply ".... [Name Redacted] ... " in your code snippet, what was the FORM of the material that was redacted? A simple proper name or a substituted name via concatenation?
 
I'll just go ahead and provide the actual code in the file. Not sure why I originally felt this had to be redacted, it's really nothing.

Code:
msgbox "Press OK to open the Reconciliation Database",vbInformation,"  "
 
In the spirt of the rabbit-hole this thread has gone down (PS/VBScript), Daniel Pineault has done a few articles recently on VBA and PowerShell and how they can work together.

Here is the latest one.
 
Here is is, almost 2 years later and I have finally gotten around to it ( A round TUIT) - mostly out of the fear, but I did get there! Took about a day all-in but ChatGPT really stream-lined the process.
 

Users who are viewing this thread

Back
Top Bottom