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
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
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


Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…
Suggested Courses

762 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