Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I am importing to excel data from another application (Bloomberg) then creating a graph from it. I have noticed that the data is not imported properly (only the firlt line is displyed) unless I call a message box between the import of data and the graph plotting of data ( I guess it needs some kind of break in order to copy the data). My problem is that I do not want this message box and trying to find a way to closed automatically, I have tried sendimg {enter} via send key, I have tried to just put a Application.Wait Now + TimeValue("00:00:05") intead of calling a msgbox. But all that dis not work either. Any idea Thanks Dan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is some code for a timed message box... Make sure to add the reference
via Tools - References. 'requires reference to "Windows Script Host Object Model" Public Sub MessageTest() Dim SH As IWshRuntimeLibrary.WshShell Dim Res As Long Set SH = New IWshRuntimeLibrary.WshShell Res = SH.Popup(Text:="Click Me", secondstowait:=2, _ Title:="Hello, World", Type:=vbOKOnly) End Sub -- HTH... Jim Thomlinson "Dan" wrote: Hi, I am importing to excel data from another application (Bloomberg) then creating a graph from it. I have noticed that the data is not imported properly (only the firlt line is displyed) unless I call a message box between the import of data and the graph plotting of data ( I guess it needs some kind of break in order to copy the data). My problem is that I do not want this message box and trying to find a way to closed automatically, I have tried sendimg {enter} via send key, I have tried to just put a Application.Wait Now + TimeValue("00:00:05") intead of calling a msgbox. But all that dis not work either. Any idea Thanks Dan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you Jim,
I have put the reference but it is still waiting for the user to click OK and does not close on it's own. "Jim Thomlinson" wrote: Here is some code for a timed message box... Make sure to add the reference via Tools - References. 'requires reference to "Windows Script Host Object Model" Public Sub MessageTest() Dim SH As IWshRuntimeLibrary.WshShell Dim Res As Long Set SH = New IWshRuntimeLibrary.WshShell Res = SH.Popup(Text:="Click Me", secondstowait:=2, _ Title:="Hello, World", Type:=vbOKOnly) End Sub -- HTH... Jim Thomlinson "Dan" wrote: Hi, I am importing to excel data from another application (Bloomberg) then creating a graph from it. I have noticed that the data is not imported properly (only the firlt line is displyed) unless I call a message box between the import of data and the graph plotting of data ( I guess it needs some kind of break in order to copy the data). My problem is that I do not want this message box and trying to find a way to closed automatically, I have tried sendimg {enter} via send key, I have tried to just put a Application.Wait Now + TimeValue("00:00:05") intead of calling a msgbox. But all that dis not work either. Any idea Thanks Dan |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Set the SecondsToWait at 1 second. Sometimes it takes a bit longer than the
preset time to close. -- HTH... Jim Thomlinson "Dan" wrote: Thank you Jim, I have put the reference but it is still waiting for the user to click OK and does not close on it's own. "Jim Thomlinson" wrote: Here is some code for a timed message box... Make sure to add the reference via Tools - References. 'requires reference to "Windows Script Host Object Model" Public Sub MessageTest() Dim SH As IWshRuntimeLibrary.WshShell Dim Res As Long Set SH = New IWshRuntimeLibrary.WshShell Res = SH.Popup(Text:="Click Me", secondstowait:=2, _ Title:="Hello, World", Type:=vbOKOnly) End Sub -- HTH... Jim Thomlinson "Dan" wrote: Hi, I am importing to excel data from another application (Bloomberg) then creating a graph from it. I have noticed that the data is not imported properly (only the firlt line is displyed) unless I call a message box between the import of data and the graph plotting of data ( I guess it needs some kind of break in order to copy the data). My problem is that I do not want this message box and trying to find a way to closed automatically, I have tried sendimg {enter} via send key, I have tried to just put a Application.Wait Now + TimeValue("00:00:05") intead of calling a msgbox. But all that dis not work either. Any idea Thanks Dan |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Unfortunately the wsh method to close a msgbox is notoriously unreliable.
Referring to your OP, if I understand you only need to temporarily display the msgbox to overcome some other problem and not as feedback to user. Actually I don't understand that at all but if that's really all you want to do try this - Application.SendKeys "{ESC}" MsgBox "Gone so soon" Regards, Peter T "Dan" wrote in message ... Thank you Jim, I have put the reference but it is still waiting for the user to click OK and does not close on it's own. "Jim Thomlinson" wrote: Here is some code for a timed message box... Make sure to add the reference via Tools - References. 'requires reference to "Windows Script Host Object Model" Public Sub MessageTest() Dim SH As IWshRuntimeLibrary.WshShell Dim Res As Long Set SH = New IWshRuntimeLibrary.WshShell Res = SH.Popup(Text:="Click Me", secondstowait:=2, _ Title:="Hello, World", Type:=vbOKOnly) End Sub -- HTH... Jim Thomlinson "Dan" wrote: Hi, I am importing to excel data from another application (Bloomberg) then creating a graph from it. I have noticed that the data is not imported properly (only the firlt line is displyed) unless I call a message box between the import of data and the graph plotting of data ( I guess it needs some kind of break in order to copy the data). My problem is that I do not want this message box and trying to find a way to closed automatically, I have tried sendimg {enter} via send key, I have tried to just put a Application.Wait Now + TimeValue("00:00:05") intead of calling a msgbox. But all that dis not work either. Any idea Thanks Dan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Msgbox Close Button | Excel Programming | |||
Close msgbox ? | Excel Programming | |||
Novice - MsgBox Yes/No - Continue if Yes, Close if No | Excel Discussion (Misc queries) | |||
Close a MsgBox | Excel Programming | |||
auto close while MsgBox is open | Excel Programming |