Thread
:
Msg Box Title
View Single Post
#
5
Posted to microsoft.public.excel.newusers
Walter Briscoe
external usenet poster
Posts: 279
Msg Box Title
In message of Sun, 3 Mar 2013
13:03:34 in microsoft.public.excel.newusers, Gene Haines <Gene.Haines.b7
writes
Gene Haines;1609945 Wrote:
Thank you Walter: I will set this up.
Regards
Gene
Walter: Forgive my lack of VBA experience, but I am not sure where to
I suggest you lack understanding rather than knowledge.
go
from here. I've pasted the code and can't figure out how to get oast
Pasting was not an appropriate operation.
You needed to merge the ideas in my code with your own.
Why did you throw away the indentation in my code?
It aids understanding.
the
Compile Error: Expected End Sub in the Private WorkBook-Open()
What did you do in response to that error, other than post?
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
You might try a module like this.
Option Explicit
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
Private Sub Workbook_Open()
Const Msg As String = "You owe a balance to Virginia!" & _
vbLf & vbLf & _
"Would you like to fufill that obligation" & _
" with a Funds Transfer?"
Const fname As String = "C:\Documents and Settings\" & _
"MyFolder\My Documents\TestII.xlsx"
If Worksheets("Sheet1").Range("F2").Value 0 Then
If MIDMsg(Msg, vbYesNo + vbQuestion) = vbYes Then
Workbooks.Open fname
Else
MIDMsg "Then please do a Journal Voucher. Thank you."
End If
Else
MIDMsg "No Balance Owed"
End If
End Sub
I have thrown away some of your text.
--
Walter Briscoe
Reply With Quote
Walter Briscoe
View Public Profile
Find all posts by Walter Briscoe