output as text file in VB 6.0

Posted on 2003-02-19
Medium Priority
Last Modified: 2010-05-01
Hello All,
   I'm a mechanical engineer working with CAD/CAE packages. I'm working with VB to customize one of my applications. By a simple vb program i need to create a macro file, which will run in my CAD software. the CAD macro consists of 90 lines. Only in few places few numbers will vary. for that, i made a form by which, i can get 10 variable values(assume a1,a2,..a10). here are my questions...
1. I need to create a sentence in output which will be like this:"ASK_ITEM 102 (1 REAL) = 5.1", here the variable will hold the value "5.1"
2. The output of the program should be "shaft.macro" in the location d:\backup\shaft\...
note: the macro is nothing but a txt file.
I'm very beginner to vb. So please give me the source codes or let me know where I can get the source code.
Thanks in advance
Question by:tovisu
LVL 53

Accepted Solution

Dhaest earned 75 total points
ID: 7985858
Dim fh As Integer
fh = FreeFile
Open "d:\backup\shaft\shaft.macro" For output As fh

Print #fh, "ASK_ITEM 102 (1 REAL) = " & a1
(add all the lines you want to print)

close fh

Your file is now made :)

Expert Comment

ID: 7986222
Hi Visu,

I Can't Able to get U Clearly. Are u want to get the Variables From User, Or u Find out Those From Your Application?

On File Concepts Mr.Dhaest's Example Works Fine.


Author Comment

ID: 7992046
Hello Dhaest,
Now I got, What I want. Thank u soo much for your early answer. It's a timely help.
Best Regards

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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

621 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