Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 15th, 2007, 07:02 PM
Authorized User
 
Join Date: Dec 2006
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old February 16th, 2007, 11:20 AM
Authorized User
 
Join Date: Dec 2006
Location: , , .
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

Reply With Quote
  #3 (permalink)  
Old February 16th, 2007, 06:40 PM
Friend of Wrox
 
Join Date: May 2006
Location: San Diego, CA, USA.
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You are welcome.

Woody Z
http://www.learntoprogramnow.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 11:47 PM.


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