PC Review


Reply
Thread Tools Rate Thread

close msgbox

 
 
=?Utf-8?B?RGFu?=
Guest
Posts: n/a
 
      30th Jul 2007
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 With Quote
 
 
 
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      30th Jul 2007
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 With Quote
 
=?Utf-8?B?RGFu?=
Guest
Posts: n/a
 
      30th Jul 2007
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 With Quote
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      30th Jul 2007
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

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      30th Jul 2007
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" <(E-Mail Removed)> wrote in message
news:7F9DD7CB-66E3-45BE-84E7-(E-Mail Removed)...
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Msgbox Close with vba art Microsoft Excel Programming 10 20th Nov 2008 01:23 PM
Close a msgbox John Wright Microsoft VB .NET 2 22nd Apr 2006 06:36 AM
Close msgbox ? Buddy Lee Microsoft Excel Programming 3 22nd Nov 2005 04:14 PM
Close MsgBox dbl Microsoft Access Reports 3 24th Mar 2005 07:53 PM
Close a MsgBox Taffy Microsoft Excel Programming 6 4th Oct 2004 09:39 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:33 PM.