TheSwamp
Code Red => VB(A) => Topic started by: krampaul82 on June 30, 2010, 05:03:50 PM
-
<see attached modules>
This program will take and create a new project directory structure with a user assigned project name, number etc.
once a new project has been created it somtimes needs to have a project number re-assigned is there a way to rename these files the same way they were created? I hope I am making sense here...
is there a way to have the program continue after this msgbox without hitting OK? (like a little 2 second delay and the program will continue)
MsgBox "Excel Files W/Prefix are in place. On to the Data Extraction Files..."
-
Try this...
Sub TimedMsgBox()
Dim cTime As Long
Dim WSH As Object
Set WSH = CreateObject("WScript.Shell")
cTime = 2 ' 2 secs
Select Case WSH.Popup("Open an Excel file?!", cTime, "Question", vbYesNo)
Case vbOK
MsgBox "You clicked OK"
Case vbCancel
MsgBox "You clicked Cancel"
Case -1
MsgBox "Timed out"
Case Else
End Select
End Sub
-
Matt,
Well, now I learned a new way to display a message box, thank you for that code but I want to display a message for a brief time and then continue on to the next line of code without the user having to hit "OK" Is this possible? :|
Mark
-
That's what that code does; it displays a msgbox for 2 seconds then continues. The lines that read:
Case -1
MsgBox "Timed out"
is where you would put your code to continue.
-
Matt
The message box just sits there infinitely, it does not continue...
Select Case WSH.Popup("Open an Excel file?!", cTime, "Question", vbYesNo) should this be vbok?
Case vbOK
MsgBox "You clicked OK"
Case vbCancel
MsgBox "You clicked Cancel"
Case -1
MsgBox "Timed out"
Case Else
End Select
Mark
-
It looks like you didn't copy the entire chunk of code. What you just posted is missing
Dim cTime As Long
Dim WSH As Object
Set WSH = CreateObject("WScript.Shell")
cTime = 2 ' 2 secs
-
I put your entire code in a module and call the sub from where I placed the msgbox code still no dice.... :oops:
-
Can you post all or part of the code? Are you doing it in Excel or AutoCAD?
-
Matt
Look at posted module #1 (kind of long) but the sub "gtc_move_Excell" call's from module3 (posted) where i now display the msgbox is where I now would call your sub "TimedMsgBox" instead. this works and by that i mean it displays a msgbox but it does not timeout. I guess i could skip the msgbox alltogether and quietly finish the program but i like to let the user know where the program is at....
Mark
-
Take a look at this sample I threw together. Run the MAIN sub. It will prompt you to open an Excel file. Don't do anything. After 2 seconds, it will automatically continue by loading a userform (frmMain) and which will display a progress bar.
Instead of loading the form, you would put in your code to do whatever it is you want.
-
You only supplied the progerss bar.... ;-)