?
Solved

Loop needed

Posted on 2003-11-07
5
Medium Priority
?
270 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 18

Expert Comment

by:bobbit31
ID: 9702632
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
ID: 9702703
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 200 total points
ID: 9702815
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
ID: 9702870
oops, typo ;) sorry for the confusion
0
 

Author Comment

by:vharrig
ID: 9702893
Thank you very much. That worked perfectly.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…
Suggested Courses
Course of the Month10 days, 14 hours left to enroll

765 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