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:
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
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.
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,848
Members
452,361
Latest member
d3ad3y3

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top