Msg Box Title
Totally new to VBA. I have pasted a VBA code and was wondering how I can keep the MsgBox Title consistent throughout the VBA procedure. I have the following code but when the ans = vbno, the MsgBox Title is "Microsoft Excel" and not "Metals Inventory Database". Any help would be greatly appreciated.
Private Sub Workbook_Open() If Worksheets("Sheet1").Range("F2").Value 0 Then Msg = "You owe a balance due to Virginia at this time!" Msg = Msg & vbLf & vbLf Msg = Msg & "Would you like to fufill that obligation" Msg = Msg & " with a Funds Transfer?" Title = "Metals Inventory Database" Config = vbYesNo + vbQuestion Ans = MsgBox(Msg, Config, Title) If Ans = vbYes Then Workbooks.Open ("C:\Documents and Settings\My Folder\My Documents\TestII.xlsx") If Ans = vbNo Then MsgBox ("Then please do a Journal Voucher. Thank you.") Else MsgBox ("No Blance Owed") End If End Sub Thank you |
Msg Box Title
|
Quote:
Regards Gene |
Quote:
Option Explicit Private Sub Workbook_Open() If Worksheets("Sheet1").Range("F2").Value 0 Then Public Sub foo() Dim Msg As String Private Function MIDMsg(ByVal Msg As String, Optional ByVal Config As Long = 0) As Long Const Title As String = "Metals Inventory Database" MIDMsg = MsgBox(Msg, Config, Title) End Function If True Then Msg = "You owe a balance due to Virginia at this time!" & _ vbLf & vbLf & _ "Would you like to fufill that obligation" & _ " with a Funds Transfer?" ' Brackets in call statements seem odd to me If MIDMsg(Msg, vbYesNo + vbQuestion) = vbYes Then ' Use call if you really want to have brackets Call Workbooks.Open("C:\Documents and Settings\My Folder\My Documents\TestII.xlsx") Else ' Or leave them out for textual economy. MIDMsg "Then please do a Journal Voucher. Thank you." End If Else ' I have corrected a slip. MIDMsg "No Balance Owed" End If End Sub |
Msg Box Title
|
Walter: I actually tried to solve the problem myself believe it or not. I put in an Else If and then an End Sub and the code stopped, which I guess it should have. I cannot fully understand at this time exactly how the processes flow in VBA Code This is my first attempt in VBA. I am looking for a user friendly VBA book to purchase and teach myself. Thanks for you input.
Regards Gene |
All times are GMT +1. The time now is 11:12 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com