![]() |
close msgbox
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 |
close msgbox
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 |
close msgbox
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 |
close msgbox
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 |
close msgbox
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 |
All times are GMT +1. The time now is 12:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com