PC Review


Reply
Thread Tools Rate Thread

API run program

 
 
Johan
Guest
Posts: n/a
 
      18th Oct 2008
i am new to programming.
I want to run a program and if it gives an error the OK button should be
pressed automaticly

Any help to this???

I know that I must use API but how to I activate API in excel?
 
Reply With Quote
 
 
 
 
ShaneDevenshire
Guest
Posts: n/a
 
      18th Oct 2008
Hi,

Please give us more info on what you are doing, like the code. For one
thing, you don't need to call an API to click an OK button. You should just
build in an error trap, an error handler to deal with the error, and that can
all be done in Excel.


--
Thanks,
Shane Devenshire


"Johan" wrote:

> i am new to programming.
> I want to run a program and if it gives an error the OK button should be
> pressed automaticly
>
> Any help to this???
>
> I know that I must use API but how to I activate API in excel?

 
Reply With Quote
 
Johan
Guest
Posts: n/a
 
      18th Oct 2008
Something like this is my code:

Dim Shell
Set Shell = CreateObject("WScript.Shell")
Shell.Run "c:\battest\vbimport", 1
SendKeys "{enter}"

The file vbimport gives an error, and I want to send the key Enter to the
message box.

Thanks
ShaneDevenshire skrev:

> Hi,
>
> Please give us more info on what you are doing, like the code. For one
> thing, you don't need to call an API to click an OK button. You should just
> build in an error trap, an error handler to deal with the error, and that can
> all be done in Excel.
>
>
> --
> Thanks,
> Shane Devenshire
>
>
> "Johan" wrote:
>
> > i am new to programming.
> > I want to run a program and if it gives an error the OK button should be
> > pressed automaticly
> >
> > Any help to this???
> >
> > I know that I must use API but how to I activate API in excel?

 
Reply With Quote
 
Sheeloo
Guest
Posts: n/a
 
      19th Oct 2008
Try
SendKeys "~", True
instead of SendKeys "{enter}"
--
Always provide your feedback so that others know whether the solution worked
or problem still persists ...


"Johan" wrote:

> Something like this is my code:
>
> Dim Shell
> Set Shell = CreateObject("WScript.Shell")
> Shell.Run "c:\battest\vbimport", 1
> SendKeys "{enter}"
>
> The file vbimport gives an error, and I want to send the key Enter to the
> message box.
>
> Thanks
> ShaneDevenshire skrev:
>
> > Hi,
> >
> > Please give us more info on what you are doing, like the code. For one
> > thing, you don't need to call an API to click an OK button. You should just
> > build in an error trap, an error handler to deal with the error, and that can
> > all be done in Excel.
> >
> >
> > --
> > Thanks,
> > Shane Devenshire
> >
> >
> > "Johan" wrote:
> >
> > > i am new to programming.
> > > I want to run a program and if it gives an error the OK button should be
> > > pressed automaticly
> > >
> > > Any help to this???
> > >
> > > I know that I must use API but how to I activate API in excel?

 
Reply With Quote
 
Johan
Guest
Posts: n/a
 
      19th Oct 2008
vbimport is a chortcut to a program.

Steve Yandl skrev:

> What type of file is vbimport? Does it have a file extension (you may not
> see the file extension if Windows Explorer is set to hide extensions of
> known file types but the extension may be important here)? Is vbimport a
> batch file or a vbScript file or something else?
>
> Steve Yandl
>
> "Johan" <(E-Mail Removed)> wrote in message
> newsC6BCAF3-8156-41DA-AAE7-(E-Mail Removed)...
> > Something like this is my code:
> >
> > Dim Shell
> > Set Shell = CreateObject("WScript.Shell")
> > Shell.Run "c:\battest\vbimport", 1
> > SendKeys "{enter}"
> >
> > The file vbimport gives an error, and I want to send the key Enter to the
> > message box.
> >
> > Thanks
> > ShaneDevenshire skrev:
> >
> >> Hi,
> >>
> >> Please give us more info on what you are doing, like the code. For one
> >> thing, you don't need to call an API to click an OK button. You should
> >> just
> >> build in an error trap, an error handler to deal with the error, and that
> >> can
> >> all be done in Excel.
> >>
> >>
> >> --
> >> Thanks,
> >> Shane Devenshire
> >>
> >>
> >> "Johan" wrote:
> >>
> >> > i am new to programming.
> >> > I want to run a program and if it gives an error the OK button should
> >> > be
> >> > pressed automaticly
> >> >
> >> > Any help to this???
> >> >
> >> > I know that I must use API but how to I activate API in excel?

>
>
>

 
Reply With Quote
 
Sheeloo
Guest
Posts: n/a
 
      19th Oct 2008
Did you try SendKeys "~", True?
--
Always provide your feedback so that others know whether the solution worked
or problem still persists ...


"Johan" wrote:

> vbimport is a chortcut to a program.
>
> Steve Yandl skrev:
>
> > What type of file is vbimport? Does it have a file extension (you may not
> > see the file extension if Windows Explorer is set to hide extensions of
> > known file types but the extension may be important here)? Is vbimport a
> > batch file or a vbScript file or something else?
> >
> > Steve Yandl
> >
> > "Johan" <(E-Mail Removed)> wrote in message
> > newsC6BCAF3-8156-41DA-AAE7-(E-Mail Removed)...
> > > Something like this is my code:
> > >
> > > Dim Shell
> > > Set Shell = CreateObject("WScript.Shell")
> > > Shell.Run "c:\battest\vbimport", 1
> > > SendKeys "{enter}"
> > >
> > > The file vbimport gives an error, and I want to send the key Enter to the
> > > message box.
> > >
> > > Thanks
> > > ShaneDevenshire skrev:
> > >
> > >> Hi,
> > >>
> > >> Please give us more info on what you are doing, like the code. For one
> > >> thing, you don't need to call an API to click an OK button. You should
> > >> just
> > >> build in an error trap, an error handler to deal with the error, and that
> > >> can
> > >> all be done in Excel.
> > >>
> > >>
> > >> --
> > >> Thanks,
> > >> Shane Devenshire
> > >>
> > >>
> > >> "Johan" wrote:
> > >>
> > >> > i am new to programming.
> > >> > I want to run a program and if it gives an error the OK button should
> > >> > be
> > >> > pressed automaticly
> > >> >
> > >> > Any help to this???
> > >> >
> > >> > I know that I must use API but how to I activate API in excel?

> >
> >
> >

 
Reply With Quote
 
Johan
Guest
Posts: n/a
 
      19th Oct 2008
The problem is that the code moves on before I got the error code, How do I
get the code to wait

Sheeloo skrev:

> Did you try SendKeys "~", True?
> --
> Always provide your feedback so that others know whether the solution worked
> or problem still persists ...
>
>
> "Johan" wrote:
>
> > vbimport is a chortcut to a program.
> >
> > Steve Yandl skrev:
> >
> > > What type of file is vbimport? Does it have a file extension (you may not
> > > see the file extension if Windows Explorer is set to hide extensions of
> > > known file types but the extension may be important here)? Is vbimport a
> > > batch file or a vbScript file or something else?
> > >
> > > Steve Yandl
> > >
> > > "Johan" <(E-Mail Removed)> wrote in message
> > > newsC6BCAF3-8156-41DA-AAE7-(E-Mail Removed)...
> > > > Something like this is my code:
> > > >
> > > > Dim Shell
> > > > Set Shell = CreateObject("WScript.Shell")
> > > > Shell.Run "c:\battest\vbimport", 1
> > > > SendKeys "{enter}"
> > > >
> > > > The file vbimport gives an error, and I want to send the key Enter to the
> > > > message box.
> > > >
> > > > Thanks
> > > > ShaneDevenshire skrev:
> > > >
> > > >> Hi,
> > > >>
> > > >> Please give us more info on what you are doing, like the code. For one
> > > >> thing, you don't need to call an API to click an OK button. You should
> > > >> just
> > > >> build in an error trap, an error handler to deal with the error, and that
> > > >> can
> > > >> all be done in Excel.
> > > >>
> > > >>
> > > >> --
> > > >> Thanks,
> > > >> Shane Devenshire
> > > >>
> > > >>
> > > >> "Johan" wrote:
> > > >>
> > > >> > i am new to programming.
> > > >> > I want to run a program and if it gives an error the OK button should
> > > >> > be
> > > >> > pressed automaticly
> > > >> >
> > > >> > Any help to this???
> > > >> >
> > > >> > I know that I must use API but how to I activate API in excel?
> > >
> > >
> > >

 
Reply With Quote
 
Sheeloo
Guest
Posts: n/a
 
      19th Oct 2008
Here is the complete code
Sub testSendKeys()
Dim ReturnValue
ReturnValue = Shell(c:\battest\vbimport,1)
AppActivate ReturnValue
SendKeys "~" , TRUE
End Sub


--
Always provide your feedback so that others know whether the solution worked
or problem still persists ...


"Johan" wrote:

> The problem is that the code moves on before I got the error code, How do I
> get the code to wait
>
> Sheeloo skrev:
>
> > Did you try SendKeys "~", True?
> > --
> > Always provide your feedback so that others know whether the solution worked
> > or problem still persists ...
> >
> >
> > "Johan" wrote:
> >
> > > vbimport is a chortcut to a program.
> > >
> > > Steve Yandl skrev:
> > >
> > > > What type of file is vbimport? Does it have a file extension (you may not
> > > > see the file extension if Windows Explorer is set to hide extensions of
> > > > known file types but the extension may be important here)? Is vbimport a
> > > > batch file or a vbScript file or something else?
> > > >
> > > > Steve Yandl
> > > >
> > > > "Johan" <(E-Mail Removed)> wrote in message
> > > > newsC6BCAF3-8156-41DA-AAE7-(E-Mail Removed)...
> > > > > Something like this is my code:
> > > > >
> > > > > Dim Shell
> > > > > Set Shell = CreateObject("WScript.Shell")
> > > > > Shell.Run "c:\battest\vbimport", 1
> > > > > SendKeys "{enter}"
> > > > >
> > > > > The file vbimport gives an error, and I want to send the key Enter to the
> > > > > message box.
> > > > >
> > > > > Thanks
> > > > > ShaneDevenshire skrev:
> > > > >
> > > > >> Hi,
> > > > >>
> > > > >> Please give us more info on what you are doing, like the code. For one
> > > > >> thing, you don't need to call an API to click an OK button. You should
> > > > >> just
> > > > >> build in an error trap, an error handler to deal with the error, and that
> > > > >> can
> > > > >> all be done in Excel.
> > > > >>
> > > > >>
> > > > >> --
> > > > >> Thanks,
> > > > >> Shane Devenshire
> > > > >>
> > > > >>
> > > > >> "Johan" wrote:
> > > > >>
> > > > >> > i am new to programming.
> > > > >> > I want to run a program and if it gives an error the OK button should
> > > > >> > be
> > > > >> > pressed automaticly
> > > > >> >
> > > > >> > Any help to this???
> > > > >> >
> > > > >> > I know that I must use API but how to I activate API in excel?
> > > >
> > > >
> > > >

 
Reply With Quote
 
Johan
Guest
Posts: n/a
 
      19th Oct 2008
Thanks but now I got an error on this line:
ReturnValue = Shell("c:\battest\vbimport", 1)

saying:
Object does not support this property or metode

Hope you can help the beginner!!!

Thanks
Johan
Sheeloo skrev:

> Here is the complete code
> Sub testSendKeys()
> Dim ReturnValue
> ReturnValue = Shell(c:\battest\vbimport,1)
> AppActivate ReturnValue
> SendKeys "~" , TRUE
> End Sub
>
>
> --
> Always provide your feedback so that others know whether the solution worked
> or problem still persists ...
>
>
> "Johan" wrote:
>
> > The problem is that the code moves on before I got the error code, How do I
> > get the code to wait
> >
> > Sheeloo skrev:
> >
> > > Did you try SendKeys "~", True?
> > > --
> > > Always provide your feedback so that others know whether the solution worked
> > > or problem still persists ...
> > >
> > >
> > > "Johan" wrote:
> > >
> > > > vbimport is a chortcut to a program.
> > > >
> > > > Steve Yandl skrev:
> > > >
> > > > > What type of file is vbimport? Does it have a file extension (you may not
> > > > > see the file extension if Windows Explorer is set to hide extensions of
> > > > > known file types but the extension may be important here)? Is vbimport a
> > > > > batch file or a vbScript file or something else?
> > > > >
> > > > > Steve Yandl
> > > > >
> > > > > "Johan" <(E-Mail Removed)> wrote in message
> > > > > newsC6BCAF3-8156-41DA-AAE7-(E-Mail Removed)...
> > > > > > Something like this is my code:
> > > > > >
> > > > > > Dim Shell
> > > > > > Set Shell = CreateObject("WScript.Shell")
> > > > > > Shell.Run "c:\battest\vbimport", 1
> > > > > > SendKeys "{enter}"
> > > > > >
> > > > > > The file vbimport gives an error, and I want to send the key Enter to the
> > > > > > message box.
> > > > > >
> > > > > > Thanks
> > > > > > ShaneDevenshire skrev:
> > > > > >
> > > > > >> Hi,
> > > > > >>
> > > > > >> Please give us more info on what you are doing, like the code. For one
> > > > > >> thing, you don't need to call an API to click an OK button. You should
> > > > > >> just
> > > > > >> build in an error trap, an error handler to deal with the error, and that
> > > > > >> can
> > > > > >> all be done in Excel.
> > > > > >>
> > > > > >>
> > > > > >> --
> > > > > >> Thanks,
> > > > > >> Shane Devenshire
> > > > > >>
> > > > > >>
> > > > > >> "Johan" wrote:
> > > > > >>
> > > > > >> > i am new to programming.
> > > > > >> > I want to run a program and if it gives an error the OK button should
> > > > > >> > be
> > > > > >> > pressed automaticly
> > > > > >> >
> > > > > >> > Any help to this???
> > > > > >> >
> > > > > >> > I know that I must use API but how to I activate API in excel?
> > > > >
> > > > >
> > > > >

 
Reply With Quote
 
Johan
Guest
Posts: n/a
 
      19th Oct 2008
I manage to create focus to the program, but when I send the key nothing is
happening.

Any help?

Johan

Johan skrev:

> Thanks but now I got an error on this line:
> ReturnValue = Shell("c:\battest\vbimport", 1)
>
> saying:
> Object does not support this property or metode
>
> Hope you can help the beginner!!!
>
> Thanks
> Johan
> Sheeloo skrev:
>
> > Here is the complete code
> > Sub testSendKeys()
> > Dim ReturnValue
> > ReturnValue = Shell(c:\battest\vbimport,1)
> > AppActivate ReturnValue
> > SendKeys "~" , TRUE
> > End Sub
> >
> >
> > --
> > Always provide your feedback so that others know whether the solution worked
> > or problem still persists ...
> >
> >
> > "Johan" wrote:
> >
> > > The problem is that the code moves on before I got the error code, How do I
> > > get the code to wait
> > >
> > > Sheeloo skrev:
> > >
> > > > Did you try SendKeys "~", True?
> > > > --
> > > > Always provide your feedback so that others know whether the solution worked
> > > > or problem still persists ...
> > > >
> > > >
> > > > "Johan" wrote:
> > > >
> > > > > vbimport is a chortcut to a program.
> > > > >
> > > > > Steve Yandl skrev:
> > > > >
> > > > > > What type of file is vbimport? Does it have a file extension (you may not
> > > > > > see the file extension if Windows Explorer is set to hide extensions of
> > > > > > known file types but the extension may be important here)? Is vbimport a
> > > > > > batch file or a vbScript file or something else?
> > > > > >
> > > > > > Steve Yandl
> > > > > >
> > > > > > "Johan" <(E-Mail Removed)> wrote in message
> > > > > > newsC6BCAF3-8156-41DA-AAE7-(E-Mail Removed)...
> > > > > > > Something like this is my code:
> > > > > > >
> > > > > > > Dim Shell
> > > > > > > Set Shell = CreateObject("WScript.Shell")
> > > > > > > Shell.Run "c:\battest\vbimport", 1
> > > > > > > SendKeys "{enter}"
> > > > > > >
> > > > > > > The file vbimport gives an error, and I want to send the key Enter to the
> > > > > > > message box.
> > > > > > >
> > > > > > > Thanks
> > > > > > > ShaneDevenshire skrev:
> > > > > > >
> > > > > > >> Hi,
> > > > > > >>
> > > > > > >> Please give us more info on what you are doing, like the code. For one
> > > > > > >> thing, you don't need to call an API to click an OK button. You should
> > > > > > >> just
> > > > > > >> build in an error trap, an error handler to deal with the error, and that
> > > > > > >> can
> > > > > > >> all be done in Excel.
> > > > > > >>
> > > > > > >>
> > > > > > >> --
> > > > > > >> Thanks,
> > > > > > >> Shane Devenshire
> > > > > > >>
> > > > > > >>
> > > > > > >> "Johan" wrote:
> > > > > > >>
> > > > > > >> > i am new to programming.
> > > > > > >> > I want to run a program and if it gives an error the OK button should
> > > > > > >> > be
> > > > > > >> > pressed automaticly
> > > > > > >> >
> > > > > > >> > Any help to this???
> > > > > > >> >
> > > > > > >> > I know that I must use API but how to I activate API in excel?
> > > > > >
> > > > > >
> > > > > >

 
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
Uninstalled Program, but Program Name Remains in Program & Featur kuyarog Windows Vista General Discussion 3 2nd Dec 2007 12:26 AM
buffer overflow in program:c\program files\internet explorer\iexpl =?Utf-8?B?VFJBSU5NQU41NA==?= Windows XP Internet Explorer 1 17th Feb 2007 10:47 PM
Help. I am creating a Program for college, in which the Program will read a Folder and create a HTML page. Paul Microsoft VB .NET 5 15th Jul 2005 03:04 AM
Runtime Error! Program:c:\Program Files\Internet Explorer\iexplore =?Utf-8?B?Um9iZXJ0SGlsbEVEUw==?= Windows XP Internet Explorer 2 21st Jan 2005 09:52 PM
my program won't work on computer without framework, dow do i make a program that runs on every windows 2k/xp system ? bart Microsoft C# .NET 11 26th Jan 2004 05:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:53 PM.