Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default message box transient -sub by Chip Perason

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.







  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default message box transient -sub by Chip Perason


Looks like you didn't get all of the post.
What you need to do is to set a reference to the
"Windows Script Host Object Model" on the
Tools | References menu in the VBE.

Jim Cone
San Francisco, USA


"R.VENKATARAMAN" wrote in message
...
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.







  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default message box transient -sub by Chip Perason

no. in my messsage I have clearly written I have referenced the particular
refernce (see line below "unquote")


Jim Cone wrote in message
...

Looks like you didn't get all of the post.
What you need to do is to set a reference to the
"Windows Script Host Object Model" on the
Tools | References menu in the VBE.

Jim Cone
San Francisco, USA


"R.VENKATARAMAN" wrote in message
...
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.









  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default message box transient -sub by Chip Perason

Are you sure you have the right OCX referenced?

On my machine (XP, XL2003) it is called (exactly) "Windows Script Host
Object Model".

c:\windows\system32\wshom.ocx

Maybe it doesn't work on 98SE? Sorry I can't be of more help.

Gareth


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.







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default message box transient -sub by Chip Perason

thanks. there is no other reference . is the problem with windows98 or excel
version excel 2000.
the file wshom.ocx is in forlder c:\windows\system(not in system32).



Gareth wrote in message
...
Are you sure you have the right OCX referenced?

On my machine (XP, XL2003) it is called (exactly) "Windows Script Host
Object Model".

c:\windows\system32\wshom.ocx

Maybe it doesn't work on 98SE? Sorry I can't be of more help.

Gareth


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.











  #6   Report Post  
Posted to microsoft.public.excel.programming
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.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default message box transient -sub by Chip Perason

The routine appears to work for everyone else but, like you, not in my W98 /
XL2K. The msgbox pops up but does not disappear after SecondsToWait, only if
I click out.

I set a ref to "Windows Script Host Object Model" WSHOM.OCX

I get the following intellisense after typing "res = SH.Popup("

Popup(Text as String,[SecondsToWait],[Title],[Type]) As Long

So it looks like it should work, strange it doesn't. If I don't send aType
(button), the only way to close the msgbox is with Ctrl-Alt-Del. My
WSHOM.OCX is version 5.6.0.6626. I think v5.6 is current, not v1.0.

I don't recall ever having updated my WSHOM.OCX. There's one version for W98
/ ME / NT and another for all later versions of Windows. Maybe we have the
wrong version for our OS, possibly from some poor installer. I'll try and
look into it later.

Regards,
Peter T

"R.VENKATARAMAN" wrote in message
...
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.









  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default message box transient -sub by Chip Perason

Maybe we have the wrong version for our OS, possibly from some poor
installer.


I installed the latest version WSHOM.OCX 5.6.0.8825 for W98

http://www.microsoft.com/downloads/d...8F6-249C-4A72-
BFCF-FC6AF26DC390&displaylang=en&Hash=TLJCWD

No difference, still doesn't work (ie clear the popup after SecondsToWait)

Peter T


The routine appears to work for everyone else but, like you, not in my W98

/
XL2K. The msgbox pops up but does not disappear after SecondsToWait, only

if
I click out.

I set a ref to "Windows Script Host Object Model" WSHOM.OCX

I get the following intellisense after typing "res = SH.Popup("

Popup(Text as String,[SecondsToWait],[Title],[Type]) As Long

So it looks like it should work, strange it doesn't. If I don't send aType
(button), the only way to close the msgbox is with Ctrl-Alt-Del. My
WSHOM.OCX is version 5.6.0.6626. I think v5.6 is current, not v1.0.

I don't recall ever having updated my WSHOM.OCX. There's one version for

W98
/ ME / NT and another for all later versions of Windows. Maybe we have the
wrong version for our OS, possibly from some poor installer. I'll try and
look into it later.

Regards,
Peter T

"R.VENKATARAMAN" wrote in message
...
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.











  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default message box transient -sub by Chip Perason

thanks for all those who tried to help


===================
Peter T <peter_t@discussions wrote in message
...
Maybe we have the wrong version for our OS, possibly from some poor
installer.


I installed the latest version WSHOM.OCX 5.6.0.8825 for W98


http://www.microsoft.com/downloads/d...8F6-249C-4A72-
BFCF-FC6AF26DC390&displaylang=en&Hash=TLJCWD

No difference, still doesn't work (ie clear the popup after SecondsToWait)

Peter T


The routine appears to work for everyone else but, like you, not in my

W98
/
XL2K. The msgbox pops up but does not disappear after SecondsToWait,

only
if
I click out.

I set a ref to "Windows Script Host Object Model" WSHOM.OCX

I get the following intellisense after typing "res = SH.Popup("

Popup(Text as String,[SecondsToWait],[Title],[Type]) As Long

So it looks like it should work, strange it doesn't. If I don't send

aType
(button), the only way to close the msgbox is with Ctrl-Alt-Del. My
WSHOM.OCX is version 5.6.0.6626. I think v5.6 is current, not v1.0.

I don't recall ever having updated my WSHOM.OCX. There's one version for

W98
/ ME / NT and another for all later versions of Windows. Maybe we have

the
wrong version for our OS, possibly from some poor installer. I'll try

and
look into it later.

Regards,
Peter T

"R.VENKATARAMAN" wrote in message
...
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.













  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default message box transient -sub by Chip Perason

I should have made clear there's quite a difference in the way things don't
work for us. You said -
"
But I get an error message and the sub stops at the line
<Dim SH As IWshRuntimeLibrary.WshShell
"
Unlike you I don't get an error, but it just doesn't work as expected.

Regards,
Peter T

"R.VENKATARAMAN" wrote in message
...
thanks for all those who tried to help


===================
Peter T <peter_t@discussions wrote in message
...
Maybe we have the wrong version for our OS, possibly from some poor
installer.


I installed the latest version WSHOM.OCX 5.6.0.8825 for W98



http://www.microsoft.com/downloads/d...8F6-249C-4A72-
BFCF-FC6AF26DC390&displaylang=en&Hash=TLJCWD

No difference, still doesn't work (ie clear the popup after

SecondsToWait)

Peter T


The routine appears to work for everyone else but, like you, not in my

W98
/
XL2K. The msgbox pops up but does not disappear after SecondsToWait,

only
if
I click out.

I set a ref to "Windows Script Host Object Model" WSHOM.OCX

I get the following intellisense after typing "res = SH.Popup("

Popup(Text as String,[SecondsToWait],[Title],[Type]) As Long

So it looks like it should work, strange it doesn't. If I don't send

aType
(button), the only way to close the msgbox is with Ctrl-Alt-Del. My
WSHOM.OCX is version 5.6.0.6626. I think v5.6 is current, not v1.0.

I don't recall ever having updated my WSHOM.OCX. There's one version

for
W98
/ ME / NT and another for all later versions of Windows. Maybe we have

the
wrong version for our OS, possibly from some poor installer. I'll try

and
look into it later.

Regards,
Peter T

"R.VENKATARAMAN" wrote in message
...
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.

















  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default message box transient -sub by Chip Perason

Hi Peter,

Unlike you I don't get an error, but it just doesn't work as expected


My experience replicates yours, albeit with a xl2k/winXp configuration: the
message box appears (without error) but requires manual dismissal.

---
Regards,
Norman



"Peter T" <peter_t@discussions wrote in message
...
I should have made clear there's quite a difference in the way things don't
work for us. You said -
"
But I get an error message and the sub stops at the line
<Dim SH As IWshRuntimeLibrary.WshShell
"
Unlike you I don't get an error, but it just doesn't work as expected.

Regards,
Peter T



  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default message box transient -sub by Chip Perason

You could also use late binding and drop the reference:

Dim SH As Object
Dim Res As Long
Set SH = CreateObject("wscript.shell")
Res = SH.Popup(Text:="Click Me", secondstowait:=5, _
Title:="Hello, World", Type:=vbOKOnly)



"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.


--

Dave Peterson
  #13   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default message box transient -sub by Chip Perason

apologise for asking a dumb question. what is late binding. what should I
do.
I removed the tick from the reference list.
still sub stops at

Res=etc. etc..

error
<named argument not found
================================
Dave Peterson wrote in message
...
You could also use late binding and drop the reference:

Dim SH As Object
Dim Res As Long
Set SH = CreateObject("wscript.shell")
Res = SH.Popup(Text:="Click Me", secondstowait:=5, _
Title:="Hello, World", Type:=vbOKOnly)



"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.


--

Dave Peterson



  #14   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default message box transient -sub by Chip Perason

In a nutshell, late binding is not declaring your objects at design
time, rather you let them be resolved at runtime. It's therefore written
in the code and so whether or not the OCX is referenced in the VBA
project is not important: if you use late binding - it's irrelevant.
(That's not very clear is it!)

Normally early binding is better and faster, as in your original post:

Dim SH As IWshRuntimeLibrary.WshShell
Set SH = New IWshRuntimeLibrary.WshShell

rather than late binding (from Dave Peterson's email)

Dim SH As Object
Set SH = CreateObject("wscript.shell")

But occasionally late binding can be useful - for example here Dave was
hoping it might fix your problem. (Which appears to be insolvable.)

Take a look at CreateObject Function in VBA Help for more info on late
and early binding.

With respect to your OP - I think the consensus is to go with userforms!

HTH


R.VENKATARAMAN wrote:
apologise for asking a dumb question. what is late binding. what should I
do.
I removed the tick from the reference list.
still sub stops at

Res=etc. etc..

error
<named argument not found
================================
Dave Peterson wrote in message
...

You could also use late binding and drop the reference:

Dim SH As Object
Dim Res As Long
Set SH = CreateObject("wscript.shell")
Res = SH.Popup(Text:="Click Me", secondstowait:=5, _
Title:="Hello, World", Type:=vbOKOnly)



"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.


--

Dave Peterson




  #15   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default message box transient -sub by Chip Perason

as the orginator of the thread I am extremely surprised and also happy that
as an innocent I was the cause of inviting large number of responses. Of
course no final solution is reached. But that does not matter. The large
number of messages show how the newsgroup and particularly the experts in
the group try to help even novices. it is a great newsgroup which I browse
for the past more than five years and was and is responsible for myself
learning excel and vba to some extent. thanks a lot to all of you.




Gareth wrote in message
...
In a nutshell, late binding is not declaring your objects at design
time, rather you let them be resolved at runtime. It's therefore written
in the code and so whether or not the OCX is referenced in the VBA
project is not important: if you use late binding - it's irrelevant.
(That's not very clear is it!)

Normally early binding is better and faster, as in your original post:

Dim SH As IWshRuntimeLibrary.WshShell
Set SH = New IWshRuntimeLibrary.WshShell

rather than late binding (from Dave Peterson's email)

Dim SH As Object
Set SH = CreateObject("wscript.shell")

But occasionally late binding can be useful - for example here Dave was
hoping it might fix your problem. (Which appears to be insolvable.)

Take a look at CreateObject Function in VBA Help for more info on late
and early binding.

With respect to your OP - I think the consensus is to go with userforms!

HTH


R.VENKATARAMAN wrote:
apologise for asking a dumb question. what is late binding. what should

I
do.
I removed the tick from the reference list.
still sub stops at

Res=etc. etc..

error
<named argument not found
================================
Dave Peterson wrote in message
...

You could also use late binding and drop the reference:

Dim SH As Object
Dim Res As Long
Set SH = CreateObject("wscript.shell")
Res = SH.Popup(Text:="Click Me", secondstowait:=5, _
Title:="Hello, World", Type:=vbOKOnly)



"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.

--

Dave Peterson








  #16   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default message box transient -sub by Chip Perason


You could try using API's

Have a look here

http://www.xcelfiles.com/API_02.htm

--
Ivan F Moal

-----------------------------------------------------------------------
Ivan F Moala's Profile: http://www.excelforum.com/member.php...nfo&userid=195
View this thread: http://www.excelforum.com/showthread.php?threadid=38780

  #17   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default message box transient -sub by Chip Perason

Just to add...

I like to use early binding while developing the project. You get all those
intellisense and autocomplete features in the VBE.

But when I'm ready to release it to others, I'll get rid of the references,
declare any constants I used and fix my DIMs to be more generic (As Object).

This means I don't have to worry about version differences--I use version 12 and
someone else uses version 11, my program might break, because of missing
references.

But early/late binding wasn't ever going to fix the problem that the dialog
doesn't dismiss itself. (When I wrote my message, I still thought it was a "how
do I create a reference" problem.)

Gareth wrote:

In a nutshell, late binding is not declaring your objects at design
time, rather you let them be resolved at runtime. It's therefore written
in the code and so whether or not the OCX is referenced in the VBA
project is not important: if you use late binding - it's irrelevant.
(That's not very clear is it!)

Normally early binding is better and faster, as in your original post:

Dim SH As IWshRuntimeLibrary.WshShell
Set SH = New IWshRuntimeLibrary.WshShell

rather than late binding (from Dave Peterson's email)

Dim SH As Object
Set SH = CreateObject("wscript.shell")

But occasionally late binding can be useful - for example here Dave was
hoping it might fix your problem. (Which appears to be insolvable.)

Take a look at CreateObject Function in VBA Help for more info on late
and early binding.

With respect to your OP - I think the consensus is to go with userforms!

HTH

R.VENKATARAMAN wrote:
apologise for asking a dumb question. what is late binding. what should I
do.
I removed the tick from the reference list.
still sub stops at

Res=etc. etc..

error
<named argument not found
================================
Dave Peterson wrote in message
...

You could also use late binding and drop the reference:

Dim SH As Object
Dim Res As Long
Set SH = CreateObject("wscript.shell")
Res = SH.Popup(Text:="Click Me", secondstowait:=5, _
Title:="Hello, World", Type:=vbOKOnly)



"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.

--

Dave Peterson





--

Dave Peterson
  #18   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default message box transient -sub by Chip Perason

Hi Dave,

I didn't mean to give the impression you were suggesting late binding
would fix the box not dismissing itself. Rather, the OP's problem was
that he couldn't get it to even compile, on his 98SE machine, past the
wshshell declaration. As a fix for that, it seemed like a good
suggestion. Sorry if it wasn't clear.

Best regards,
Gareth

Dave Peterson wrote:
Just to add...

I like to use early binding while developing the project. You get all those
intellisense and autocomplete features in the VBE.

But when I'm ready to release it to others, I'll get rid of the references,
declare any constants I used and fix my DIMs to be more generic (As Object).

This means I don't have to worry about version differences--I use version 12 and
someone else uses version 11, my program might break, because of missing
references.

But early/late binding wasn't ever going to fix the problem that the dialog
doesn't dismiss itself. (When I wrote my message, I still thought it was a "how
do I create a reference" problem.)

Gareth wrote:

In a nutshell, late binding is not declaring your objects at design
time, rather you let them be resolved at runtime. It's therefore written
in the code and so whether or not the OCX is referenced in the VBA
project is not important: if you use late binding - it's irrelevant.
(That's not very clear is it!)

Normally early binding is better and faster, as in your original post:

Dim SH As IWshRuntimeLibrary.WshShell
Set SH = New IWshRuntimeLibrary.WshShell

rather than late binding (from Dave Peterson's email)

Dim SH As Object
Set SH = CreateObject("wscript.shell")

But occasionally late binding can be useful - for example here Dave was
hoping it might fix your problem. (Which appears to be insolvable.)

Take a look at CreateObject Function in VBA Help for more info on late
and early binding.

With respect to your OP - I think the consensus is to go with userforms!

HTH

R.VENKATARAMAN wrote:

apologise for asking a dumb question. what is late binding. what should I
do.
I removed the tick from the reference list.
still sub stops at

Res=etc. etc..

error
<named argument not found
================================
Dave Peterson wrote in message
...


You could also use late binding and drop the reference:

Dim SH As Object
Dim Res As Long
Set SH = CreateObject("wscript.shell")
Res = SH.Popup(Text:="Click Me", secondstowait:=5, _
Title:="Hello, World", Type:=vbOKOnly)



"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.

--

Dave Peterson




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thank you Chip Pearson Michael Excel Discussion (Misc queries) 3 February 5th 05 08:35 PM
John, Bob, Chip... teabag[_2_] Excel Programming 0 January 16th 04 10:26 AM
CHIP PEARSON - THANX bertieBassett Excel Programming 0 November 3rd 03 02:01 PM
Chip Pearson or someone Chip Pearson Excel Programming 3 September 18th 03 05:22 AM
For chip about scroll GUS Excel Programming 1 August 22nd 03 06:44 PM


All times are GMT +1. The time now is 10:09 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"