Solved

Loop needed

Posted on 2003-11-07
5
263 Views
Last Modified: 2011-04-14
Could somebody please help me with a simple loop. I need the code below to take the value entered into "b" and increment it until it reaches b+12, then exit. I've tried different loops and they have all failed or got stuck in an enternal loop. Any assistance would be greatly appreciated. Thank you.

Sub a11()

    On Error GoTo ErrorHandler

    Const NEVER_TIME_OUT = 0

    Dim BS As String    ' Chr$(rcBS) = Chr$(8) = Control-H
    Dim ESC As String   ' Chr$(rcESC) = Chr$(27) = Control-[

    BS = Chr$(rcBS)
    ESC = Chr$(rcESC)

With Session

b = Application.InputBox("Enter the beginning VT1 SDF")

   
    .Transmit "ent-vt1::vt1-" & b & "-1&&-28:veo;"
Session.Wait 10

'Call a12
Exit Sub

ErrorHandler:
    .MsgBox Err.Description, vbExclamation + vbOKOnly

    End With
End Sub
0
Comment
Question by:vharrig
  • 2
  • 2
5 Comments
 
LVL 18

Expert Comment

by:bobbit31
Comment Utility
With Session
   b = Application.InputBox("Enter the beginning VT1 SDF")

   for i = b to b + 12    
     .Transmit "ent-vt1::vt1-" & b & "-1&&-28:veo;"
     Session.Wait 10
   next
0
 

Author Comment

by:vharrig
Comment Utility
bobbit31

Thank you, but the same value keeps coming up. I'm entering 673 into the inputbox and I need it to increment 674, 675 - 684. The same problem happened to me when I was trying as well. Any more suggestions?
0
 
LVL 2

Accepted Solution

by:
MaxPol earned 50 total points
Comment Utility
bobbit31 was almost right,

With Session
   b = Application.InputBox("Enter the beginning VT1 SDF")

   for i = b to b + 12    
     .Transmit "ent-vt1::vt1-" & i  & "-1&&-28:veo;"  'Verify that instead of  b, here you should place i
     Session.Wait 10
   next

So instead of b you should use i

0
 
LVL 18

Expert Comment

by:bobbit31
Comment Utility
oops, typo ;) sorry for the confusion
0
 

Author Comment

by:vharrig
Comment Utility
Thank you very much. That worked perfectly.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now