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
Solved

Loop needed

Posted on 2003-11-07
5
266 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
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 50 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb6 programatically bring window to front 8 75
Modifying Conditional Format from VBA code 3 60
vbModal 12 57
VB6 common control 6 sp6 object library not registerd 3 22
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 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