Numeric expression that identifies the Help context number assigned by the
Help author to the appropriate Help topic. If context is provided, helpfile
must also be provided. Not available on 16-bit platforms.
Where does it suggest that you can substitute a colour value?
/Al
"SubNet" <subn...@hotmail.com> wrote in message
news:ePhNBes...@cppssbbsa02.microsoft.com...
> I am trying to change the color of some text in a message box. I don't
> know if it is possible.
>
> MsgBox "Sample Red Text", vbOK, "Title",,vbRed
>
> In this example I am trying to set the text "Sample Red Text" to red.
>
> Any Ideas,
> Thanks Tim
>
>
So... The question still remains.
I will rephrase it. How to you set the color of a string to red so that it
will be displayed in red when it is used in the script.
Thanks,
Tim
"Al Dunbar" <Al_D...@HoTMaiL.com> wrote in message
news:t14bcbt...@corp.supernews.com...
> Read the docs, where the fifth argument to MSGBOX is called "context", and
> defined as:
>
> Numeric expression that identifies the Help context number assigned by the
> Help author to the appropriate Help topic. If context is provided,
helpfile
> must also be provided. Not available on 16-bit platforms.
>
> Where does it suggest that you can substitute a colour value?
>
> /Al
>
> "SubNet" <subn...@hotmail.com> wrote in message
> news:ePhNBes...@cppssbbsa02.microsoft.com...
However, some other application can be opened by your script and the
color of the text displayed by that app, used as a console, can be
altered at will (if the property is exposed). The most common candidate
for doing that is IE. There was a discussion just the other day about a
"Fake Message Box", authored by jwarrington. I made myself a copy of
the .wsf file, but failed to copy the URL. A quick search at Deja.com
for a Michael Harris message in this group or in .wsh should turn up the
reference in no time.
I have been going to school on that program and can offer this slightly
less glamorous (but still not short) example ...
' An example of using IE as a console to present an editable
' Button box
' Tom Lavedas
'
Dim oIE
set oIE = CreateObject("InternetExplorer.Application")
wsh.echo ButtonBox("A Message in Red", "Red")
Function ButtonBox(sPrompt, sColor)
With oIE
.FullScreen = True
.ToolBar = False : .RegisterAsDropTarget = False
.StatusBar = False : .Navigate("about:blank")
While .Busy : WScript.Sleep 100 : Wend
With .document
With .ParentWindow
.resizeto 300,120
.moveto .screen.width/2-150, .screen.height/2-60
End With
.WriteLn("<html><body bgColor=Silver><center>")
.WriteLn("<font size=4 color=" & sColor & ">" & _
sPrompt & "</font><p>")
.WriteLn("<button id=but1><font size=3>Done</font></button>")
.WriteLn("</center></body></html>")
With .ParentWindow.document.body
.scroll="no"
.style.borderStyle = "outset"
.style.borderWidth = "3px"
End With
.all.but1.onclick = getref("buttonbox_done")
.all.but1.focus
oIE.Visible = True
.title = sPrompt
On Error Resume Next
While oIE.Visible : WScript.Sleep 100 : Wend
End With ' document
End With ' IE
ButtonBox = "Done"
End Function
Sub buttonbox_Done
oIE.Visible = False
End Sub
Tom Lavedas
-----------
http://www.pressroom.com/~tglbatch/
SubNet wrote:
>
> Al,
> I saw that the fifth argument to MsgBox was "context" and assumed
> "incorrectly" that I could assign color context to the text.
>
> So... The question still remains.
> I will rephrase it. How to you set the color of a string to red so that it
> will be displayed in red when it is used in the script.
>
> Thanks,
> Tim
>
> "Al Dunbar" <Al_D...@HoTMaiL.com> wrote in message
> news:t14bcbt...@corp.supernews.com...
> > Read the docs, where the fifth argument to MSGBOX is called "context", and
> > defined as:
> >
> > Numeric expression that identifies the Help context number assigned by the
> > Help author to the appropriate Help topic. If context is provided,
> helpfile
> > must also be provided. Not available on 16-bit platforms.
> >
> > Where does it suggest that you can substitute a colour value?
> >
> > /Al
> >
> > "SubNet" <subn...@hotmail.com> wrote in message
> > news:ePhNBes...@cppssbbsa02.microsoft.com...
--
Michael Harris
Microsoft.MVP.Scripting
--
"Tom Lavedas" <lav...@pressroom.com> wrote in message news:3A12AD6F...@pressroom.com...
Just to elaborate a bit on Michael's cryptic comment, here's some
suggestions.
- You could use the "Ersatz Message Box" created from dhtml, and
"roll-yer-own" msgbox,
with colors, buttons, (whatever) of your own choosing.
- You could use the wsh Lite Weight Forms object, (if you are brave enough
to use a
third-party control), to make up a fake message box. Then use the "form
object" to get
at the font properties of the label on the fake msgbox. (An example of
changing font color
on a wshLWF is illustrated in the "system tray icon" demo).
- You could also use a "helper utility" to show a message box. There is one
programmed in
the "rapidq" language (a basic-like language) on my site. In effect, the
"helper utility" is
showing a rapidq form, which you may configure with any colors, text style,
etc that you like. (And, rapidq is just as easy to program as vb).
- Finally, you could use api calls to do it. There is an example of using
api calls to make a
msgbox button disappear, but no examples of changing font color, but it
could be done...
cheers, jw
"Michael Harris" <Please...@To.NewsGroup> wrote in message
news:uh1j$H6TAHA.222@cppssbbsa03...