Controlling MsgBox

  • Thread starter Thread starter Charles L. Phillips
  • Start date Start date
C

Charles L. Phillips

Hello,
Is there a way to control the height & with of information being displayed, using MsgBox???


Charles L. Phillips
 
If y're using vbCr to parse the text, it will resize your msgbox

following statement
MsgBox "Hello World and a couple of words extra"
will display differently (MsgBox is resized differently) as opposed to
MsgBox "Hello World" & vbCr & "and a couple" & vbCr & "of words extra"

If you're after something to make the MsgBox() dialog resize
regardless of width and length of text, the answer would be
Without comprehensive API calls, you can't resize MsgBox() dialogs

Even if you manage to find out how to do it, it's not worth the
developing hazzle.
Better design a taylormade Form (to act as Dialog)

Krgrds,
Perry


"Charles L. Phillips" <[email protected]> schreef in bericht Hello,
Is there a way to control the height & with of information being displayed, using MsgBox???


Charles L. Phillips
 
also using the standard messagebox often helps (especially with '97)
Private Declare Function MessageBoxA Lib "user32" (ByVal hwndOwner As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal uType As Integer) As Integer
Function MessageBox(ByVal Text As String, Optional ByVal MsgType = 0, Optional ByVal Caption As String)
Dim hwnd As Long, oldErr As DAO.Error
On Error Resume Next
Set oldErr = DAO.Errors(0)
VBA.Err.Clear
Text = Text & vbNullChar
If VBA.Len(Caption) = 0 Then Caption = TCSApp.Title(True)
VBA.Err = 0
Caption = Caption & vbNullChar
hwnd = GetCurrentDoc()
If hwnd = 0 Or VBA.Err.Number > 0 Then
hwnd = GetAccesshWnd()
End If
MessageBox = MessageBoxA(hwnd, ByVal Text, ByVal Caption, MsgType)
If oldErr Then _
VBA.Err.Raise oldErr.Number, oldErr.Source, oldErr.Description, oldErr.HelpFile, oldErr.HelpContext
End Function

I still haven't had the time to check out the use of AdressOf against this 'un to see what's tweakable...

Pieter
If y're using vbCr to parse the text, it will resize your msgbox

following statement
MsgBox "Hello World and a couple of words extra"
will display differently (MsgBox is resized differently) as opposed to
MsgBox "Hello World" & vbCr & "and a couple" & vbCr & "of words extra"

If you're after something to make the MsgBox() dialog resize
regardless of width and length of text, the answer would be
Without comprehensive API calls, you can't resize MsgBox() dialogs

Even if you manage to find out how to do it, it's not worth the
developing hazzle.
Better design a taylormade Form (to act as Dialog)

Krgrds,
Perry


"Charles L. Phillips" <[email protected]> schreef in bericht Hello,
Is there a way to control the height & with of information being displayed, using MsgBox???


Charles L. Phillips
 
Hello,
I will try this.
"Thank You..."


If y're using vbCr to parse the text, it will resize your msgbox

following statement
MsgBox "Hello World and a couple of words extra"
will display differently (MsgBox is resized differently) as opposed to
MsgBox "Hello World" & vbCr & "and a couple" & vbCr & "of words extra"

If you're after something to make the MsgBox() dialog resize
regardless of width and length of text, the answer would be
Without comprehensive API calls, you can't resize MsgBox() dialogs

Even if you manage to find out how to do it, it's not worth the
developing hazzle.
Better design a taylormade Form (to act as Dialog)

Krgrds,
Perry


"Charles L. Phillips" <[email protected]> schreef in bericht Hello,
Is there a way to control the height & with of information being displayed, using MsgBox???


Charles L. Phillips
 
Hello,
I will try this.
"Thank You..."


also using the standard messagebox often helps (especially with '97)
Private Declare Function MessageBoxA Lib "user32" (ByVal hwndOwner As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal uType As Integer) As Integer
Function MessageBox(ByVal Text As String, Optional ByVal MsgType = 0, Optional ByVal Caption As String)
Dim hwnd As Long, oldErr As DAO.Error
On Error Resume Next
Set oldErr = DAO.Errors(0)
VBA.Err.Clear
Text = Text & vbNullChar
If VBA.Len(Caption) = 0 Then Caption = TCSApp.Title(True)
VBA.Err = 0
Caption = Caption & vbNullChar
hwnd = GetCurrentDoc()
If hwnd = 0 Or VBA.Err.Number > 0 Then
hwnd = GetAccesshWnd()
End If
MessageBox = MessageBoxA(hwnd, ByVal Text, ByVal Caption, MsgType)
If oldErr Then _
VBA.Err.Raise oldErr.Number, oldErr.Source, oldErr.Description, oldErr.HelpFile, oldErr.HelpContext
End Function

I still haven't had the time to check out the use of AdressOf against this 'un to see what's tweakable...

Pieter
If y're using vbCr to parse the text, it will resize your msgbox

following statement
MsgBox "Hello World and a couple of words extra"
will display differently (MsgBox is resized differently) as opposed to
MsgBox "Hello World" & vbCr & "and a couple" & vbCr & "of words extra"

If you're after something to make the MsgBox() dialog resize
regardless of width and length of text, the answer would be
Without comprehensive API calls, you can't resize MsgBox() dialogs

Even if you manage to find out how to do it, it's not worth the
developing hazzle.
Better design a taylormade Form (to act as Dialog)

Krgrds,
Perry


"Charles L. Phillips" <[email protected]> schreef in bericht Hello,
Is there a way to control the height & with of information being displayed, using MsgBox???


Charles L. Phillips
 
Back
Top