Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA 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 October 6th, 2015, 12:43 PM
Registered User
 
Join Date: Jan 2015
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Default Called subroutine controls

I was readking that a "CALL" subroutine statement transfers control to the subroutine.

My question is: does that mean the VBA code will wait for that subroutine to complete before continuing on with its code?

{Example:)
main code
Call RTN_A
code
code
exit

RTN_A
code

In some code I wrote which works OK, I added a 5 second wait in the main code to allow the subroutine code to complete.
Application.Wait(Now + TimeValue("00:00:05")

Is this unnecessary?
Or if the call statement says, run this subroutine and continues on without waiting for it to complete, then I need the WAIT statement in my case.
 
Old October 6th, 2015, 02:10 PM
Registered User
 
Join Date: Jan 2015
Posts: 7
Thanks: 1
Thanked 0 Times in 0 Posts
Default Follow up

The code is Excel VBA calling a user-created sub procedure, which by definition, is not returning a value.

Since Excel VBA is not expecting or waiting for a value from a user created sub procedure, does the code wait for the sub procedure to complete before continuing on in the code?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Does main subroutine "wait" for a called sub to finish, or not? pthegr8 Access VBA 0 October 29th, 2014 05:41 PM
AddParameter subroutine problem greenbriar BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 May 9th, 2009 07:36 AM
vb6 subroutine to ftp a file? dgr7 VB How-To 2 January 16th, 2007 12:15 AM
Function/Subroutine Pointer Parameter pjm Access VBA 3 October 3rd, 2006 09:07 AM
calling subroutine from different module? Raif Access 2 June 15th, 2004 11:56 PM





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