Solved

Loop needed

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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 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…

705 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