Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
dan dan is offline
external usenet poster
 
Posts: 866
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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





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
Msgbox Close Button jnf40 Excel Programming 1 September 20th 06 05:45 PM
Close msgbox ? Buddy Lee Excel Programming 3 November 22nd 05 04:14 PM
Novice - MsgBox Yes/No - Continue if Yes, Close if No Beetlejuice Excel Discussion (Misc queries) 6 August 29th 05 09:48 PM
Close a MsgBox Taffy[_2_] Excel Programming 6 October 4th 04 09:39 PM
auto close while MsgBox is open Kevin Excel Programming 2 November 10th 03 12:36 AM


All times are GMT +1. The time now is 07:47 AM.

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"