Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 15th, 2007, 07:02 PM
Authorized User
 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem passing variables between Subs

hello,

I'm trying to pass two Variant variables between two Subroutines, one that calls the other one, and am getting the

error message
Run-time error '5':

Invalid procedure call or assignment

and the code stops on
AppActivate CablettersAppId

Code:
Private Sub ForTestingPurposes_Click()
Dim CablettersAppId, CabcallsAppId As Variant

    CablettersAppId = Shell("C:\Program Files\Anzio15\anzio32.exe", 1)
    CabcallsAppId = Shell("D:\PROGRAM FILES\TELSTAR\TelStar.exe", 1)

    Call CABCALLSandCABLETTERStestTelnet(CabletttersAppId, CabcallsAppId)

    Status.Text = "end of test"
End Sub


Private Sub CABCALLSandCABLETTERStestTelnet(CablettersAppId, CabcallsAppId)

    TimeDelay (7)
    AppActivate CablettersAppId
    VbSendKeys "robinson{ENTER}"
    TimeDelay (2)
    VbSendKeys "CAB{ENTER}"
    TimeDelay (2)
    VbSendKeys "DR75{ENTER}"
    TimeDelay (2)
    VbSendKeys "{ENTER}"

    TimeDelay (60 * 5)

    TimeDelay (7)
    AppActivate CabcallsAppId
    VbSendKeys "robinson{ENTER}"
    TimeDelay (2)
    VbSendKeys "ROPER{ENTER}"
    TimeDelay (2)
    VbSendKeys "DR75{ENTER}"
    TimeDelay (2)
    VbSendKeys "{ENTER}"
    TimeDelay (2)
End Sub

Now this code use to work before when I had it all contained within one Sub like this:

[code]
Private Sub ForTestingPurposes_Click()
Dim CablettersAppId, CabcallsAppId As Variant

    CablettersAppId = Shell("C:\Program Files\Anzio15\anzio32.exe", 1)
    CabcallsAppId = Shell("D:\PROGRAM FILES\TELSTAR\TelStar.exe", 1)

    TimeDelay (7)
    AppActivate CablettersAppId
    VbSendKeys "robinson{ENTER}"
    TimeDelay (2)
    VbSendKeys "CAB{ENTER}"
    TimeDelay (2)
    VbSendKeys "DR75{ENTER}"
    TimeDelay (2)
    VbSendKeys "{ENTER}"

    TimeDelay (60 * 5)

    TimeDelay (7)
    AppActivate CabcallsAppId
    VbSendKeys "robinson{ENTER}"
    TimeDelay (2)
    VbSendKeys "ROPER{ENTER}"
    TimeDelay (2)
    VbSendKeys "DR75{ENTER}"
    TimeDelay (2)
    VbSendKeys "{ENTER}"
    TimeDelay (2)
    Status.Text = "end of test"
End Sub
[\code]


Can anyone help me to get it to work in a multi-subroutine/function setting?

thanks in advance,
david

 
Old February 16th, 2007, 11:20 AM
Authorized User
 
Join Date: Dec 2006
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nevermind, I fixed the problem, had a typo
 thank you!

 
Old February 16th, 2007, 06:40 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You are welcome.

Woody Z
http://www.learntoprogramnow.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Variables CMOS Classic ASP Basics 2 January 22nd, 2006 07:38 PM
Passing variables karlirvin Beginning PHP 3 December 9th, 2005 04:37 PM
Passing variables karlirvin PHP How-To 4 December 2nd, 2005 08:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.