How do I emulate a VB6 command line program in excel?

PrettyCoolWorkshop

New Member
Joined
Feb 23, 2018
Messages
3
I need some help with a project at work. I need to translate A BUNCH (about 10,000 lines) of old VB6 code into something that will run on modern computers, and I think excel's VBA is the best choice (for IT/security reasons, they won't let me go around installing any sort of VB6 runtimes on our new computers). This project was written in VB6 sometime in the 80's, and currently we are only able to run it on one old computer we have laying around. Excel's VBA (I'm experienced in it) is very structurally / semantically similar to VB6, so it should minimize mistakes.


My question to you guys- these old programs are typically written in a style intended for a command prompt user. They ask for input, then make some computations and do some conditional branching, then ask for input again. What is the best way to emulate a command prompt interface in excel VBA?


A sample of the existing code (used to calculate screw thread dimensions) is shown below, to help give you guys an idea of what I need:


80 PRINT "ENTER THE THREAD TYPE."
90 PRINT " "
100 INPUT "Enter 1-Std thrds. 2-Metric thrds. 3-Special thrds. 4-EXIT PROGRAM";IEB
110 PRINT " "
120 IF IEB=4 THEN SYSTEM
140 IF IEB=1 THEN 170
150 IF IEB=3 THEN 170
160 PRINT "Enter all values in millimeters"
170 INPUT "Enter Nominal major diameter";D
180 PRINT " "
190 INPUT "Enter product thread length";L1
200 PRINT " "
210 INPUT "Enter thread Included angle";AN
220 PRINT " "
230 IF IEB=2 THEN 460
The closest thing I imagine to this is to create a userform with two textboxes- one as an input area and one as an output area. I should be able to call these two functions:


1. print(string1): displays the text of string1 to the output area. Easy.


2. input(string1): displays the text of string1 to the output area, and then waits for user input before proceeding to the next line. I don't know how to do this!:confused:
 

ranman256

Well-known Member
Joined
Jun 17, 2014
Messages
1,808
d = inputbox("Enter Diameter value","in millimeters")
 
Last edited:

PrettyCoolWorkshop

New Member
Joined
Feb 23, 2018
Messages
3
I spent my morning coding up a program that turns excel into a command line of sorts. I had to rely on the "DoEvents" command to do what my question originally asked.

If anyone has any interest in this I might post the code here.
 

Forum statistics

Threads
1,085,047
Messages
5,381,381
Members
401,735
Latest member
ranjithr

Some videos you may like

This Week's Hot Topics

Top