Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Thank you Chip Pearson | Excel Discussion (Misc queries) | |||
John, Bob, Chip... | Excel Programming | |||
CHIP PEARSON - THANX | Excel Programming | |||
Chip Pearson or someone | Excel Programming | |||
For chip about scroll | Excel Programming |