View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
okaizawa okaizawa is offline
external usenet poster
 
Posts: 129
Default message box transient -sub by Chip Perason

Hi,
you can find information about Popup method on the Object Browser.
(press F2 in the Visual Basic Editor)
the following works on my PC.

Sub Test1()

'Win98SE, Excel 2000
'Reference
' Library IWshRuntimeLibrary
' C:\WINDOWS\SYSTEM\WSHOM.OCX
' Windows Script Host Object Model (Ver 1.0)

Dim SH As IWshRuntimeLibrary.IWshShell_Class
Dim Res As Long
Set SH = New IWshRuntimeLibrary.IWshShell_Class
Res = SH.Popup(bstrText:="Click Me", pvarSecondsToWait:=5, _
pvarTitle:="Hello, World", pvarType:=vbOKOnly)
End Sub

Sub Test2()
Dim Res As Long
Res = CreateObject("WScript.Shell") _
.Popup("Click Me", 5, "Hello, World", 0)
End Sub

--
HTH

okaizawa


R.VENKATARAMAN wrote:
In one of my serches in googles group I found pearson's sub on having a
transient message box

quote
Dim SH As IWshRuntimeLibrary.WshShell
Dim Res As Long
Set SH = New IWshRuntimeLibrary.WshShell
Res = SH.Popup(Text:="Click Me", secondstowait:=5, _
Title:="Hello, World", Type:=vbOKOnly)
unquote

as suggested i have referenced in vbeditor tools references

<windows scripting host object model(ver 1.0)

and then run the above sub
But I get an error message and the sub stops at the line

<Dim SH As IWshRuntimeLibrary.WshShell

the error mesage is
<user defined type not defind

where I am doing the mistake

mine excel 2000
windows 98SE

request help
thanks regards.