PC Review


Reply
Thread Tools Rate Thread

Can I add this VB script to a VBA script?

 
 
=?Utf-8?B?RGVzaWduYXRlZCBEYXZl?=
Guest
Posts: n/a
 
      7th Apr 2007
I have the following VB script that I have recorded from a terminal session
at work. I wish to use this in a VBA script to manipulate the terminal to
action a repeated number of tasks to extract data and store in Excel. The
example below enters a bit of text and then actions the [enter] key.

I know I can use SendKeys and the like but the [enter] key throws up some
problems through SendKeys as the terminals I use don't always recognise the
[enter] passed by SendKeys.

Any suggestions on how I could change the format of the script below to work
within VBA would be much appreciated.

Cheers

[PCOMM SCRIPT HEADER]
LANGUAGE=VBSCRIPT
DESCRIPTION=testVB
[PCOMM SCRIPT SOURCE]
OPTION EXPLICIT
autECLSession.SetConnectionByName(ThisSessionName)

REM This line calls the macro subroutine
subSub1_

sub subSub1_()
autECLSession.autECLOIA.WaitForAppAvailable
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "12345ABCDE"
autECLSession.autECLOIA.WaitForInputReady
autECLSession.autECLPS.SendKeys "[enter]"
end sub
 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      7th Apr 2007
Checkout:

http://msdn2.microsoft.com/en-us/library/aa266281(VS.60).aspx

Additinally, once the SendKeys have been issued, include a DoEvents. This
will help to insure that the receiving app will get focus long enough to
accept the keys.
--
Gary''s Student - gsnu200714


"Designated Dave" wrote:

> I have the following VB script that I have recorded from a terminal session
> at work. I wish to use this in a VBA script to manipulate the terminal to
> action a repeated number of tasks to extract data and store in Excel. The
> example below enters a bit of text and then actions the [enter] key.
>
> I know I can use SendKeys and the like but the [enter] key throws up some
> problems through SendKeys as the terminals I use don't always recognise the
> [enter] passed by SendKeys.
>
> Any suggestions on how I could change the format of the script below to work
> within VBA would be much appreciated.
>
> Cheers
>
> [PCOMM SCRIPT HEADER]
> LANGUAGE=VBSCRIPT
> DESCRIPTION=testVB
> [PCOMM SCRIPT SOURCE]
> OPTION EXPLICIT
> autECLSession.SetConnectionByName(ThisSessionName)
>
> REM This line calls the macro subroutine
> subSub1_
>
> sub subSub1_()
> autECLSession.autECLOIA.WaitForAppAvailable
> autECLSession.autECLOIA.WaitForInputReady
> autECLSession.autECLPS.SendKeys "12345ABCDE"
> autECLSession.autECLOIA.WaitForInputReady
> autECLSession.autECLPS.SendKeys "[enter]"
> end sub

 
Reply With Quote
 
=?Utf-8?B?RGVzaWduYXRlZCBEYXZl?=
Guest
Posts: n/a
 
      8th Apr 2007
Thanks for pointing me in the right direction.

Appreciate your help.

Cheers

"Gary''s Student" wrote:

> Checkout:
>
> http://msdn2.microsoft.com/en-us/library/aa266281(VS.60).aspx
>
> Additinally, once the SendKeys have been issued, include a DoEvents. This
> will help to insure that the receiving app will get focus long enough to
> accept the keys.
> --
> Gary''s Student - gsnu200714
>
>
> "Designated Dave" wrote:
>
> > I have the following VB script that I have recorded from a terminal session
> > at work. I wish to use this in a VBA script to manipulate the terminal to
> > action a repeated number of tasks to extract data and store in Excel. The
> > example below enters a bit of text and then actions the [enter] key.
> >
> > I know I can use SendKeys and the like but the [enter] key throws up some
> > problems through SendKeys as the terminals I use don't always recognise the
> > [enter] passed by SendKeys.
> >
> > Any suggestions on how I could change the format of the script below to work
> > within VBA would be much appreciated.
> >
> > Cheers
> >
> > [PCOMM SCRIPT HEADER]
> > LANGUAGE=VBSCRIPT
> > DESCRIPTION=testVB
> > [PCOMM SCRIPT SOURCE]
> > OPTION EXPLICIT
> > autECLSession.SetConnectionByName(ThisSessionName)
> >
> > REM This line calls the macro subroutine
> > subSub1_
> >
> > sub subSub1_()
> > autECLSession.autECLOIA.WaitForAppAvailable
> > autECLSession.autECLOIA.WaitForInputReady
> > autECLSession.autECLPS.SendKeys "12345ABCDE"
> > autECLSession.autECLOIA.WaitForInputReady
> > autECLSession.autECLPS.SendKeys "[enter]"
> > end sub

 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      8th Apr 2007
Any time Dave. If you come across a good site or book that assists with
conversion of VB to VBA, I would be interested.
--
Gary''s Student - gsnu200714


"Designated Dave" wrote:

> Thanks for pointing me in the right direction.
>
> Appreciate your help.
>
> Cheers
>
> "Gary''s Student" wrote:
>
> > Checkout:
> >
> > http://msdn2.microsoft.com/en-us/library/aa266281(VS.60).aspx
> >
> > Additinally, once the SendKeys have been issued, include a DoEvents. This
> > will help to insure that the receiving app will get focus long enough to
> > accept the keys.
> > --
> > Gary''s Student - gsnu200714
> >
> >
> > "Designated Dave" wrote:
> >
> > > I have the following VB script that I have recorded from a terminal session
> > > at work. I wish to use this in a VBA script to manipulate the terminal to
> > > action a repeated number of tasks to extract data and store in Excel. The
> > > example below enters a bit of text and then actions the [enter] key.
> > >
> > > I know I can use SendKeys and the like but the [enter] key throws up some
> > > problems through SendKeys as the terminals I use don't always recognise the
> > > [enter] passed by SendKeys.
> > >
> > > Any suggestions on how I could change the format of the script below to work
> > > within VBA would be much appreciated.
> > >
> > > Cheers
> > >
> > > [PCOMM SCRIPT HEADER]
> > > LANGUAGE=VBSCRIPT
> > > DESCRIPTION=testVB
> > > [PCOMM SCRIPT SOURCE]
> > > OPTION EXPLICIT
> > > autECLSession.SetConnectionByName(ThisSessionName)
> > >
> > > REM This line calls the macro subroutine
> > > subSub1_
> > >
> > > sub subSub1_()
> > > autECLSession.autECLOIA.WaitForAppAvailable
> > > autECLSession.autECLOIA.WaitForInputReady
> > > autECLSession.autECLPS.SendKeys "12345ABCDE"
> > > autECLSession.autECLOIA.WaitForInputReady
> > > autECLSession.autECLPS.SendKeys "[enter]"
> > > end sub

 
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
<script>window.opener.location.href='MyPage.aspx';</script> Chetana Microsoft Dot NET 0 14th Feb 2008 11:23 AM
How would you write a script to add and apply a group policy in Active Directory? Script could be VBscript arpitaashokadessai@gmail.com Microsoft Windows 2000 Active Directory 1 14th Feb 2007 09:07 PM
BUG: Script blocking strips script parameters during script authorization Jonathan K. Shay Spyware Announcements 3 2nd May 2005 06:18 PM
Problem in executing a script on the server side ! Script found but nothing executed ! Cédric Rossé Microsoft ASP .NET 1 9th Nov 2004 09:43 AM
Logon script running a Kixtart script doesn't map drives when logging on from XP AcKBaR[KAC] Microsoft Windows 2000 Networking 0 25th Feb 2004 05:35 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:16 PM.