473,466 Members | 1,354 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Sending data to a text or Word file

I have written a small VB program which lists my music files on my computer,
but I
can't get it to print exactly the way I want it to. The data is viewed on
screen in
an MSFlexGrid named "TextGrid" and the following code will send it to a
printer, but I was hoping to be able to send it to either a text file or
directly to a Word for Windows file.

Private Sub Command34_Click()
Dim X%

For X% = 0 To TextGrid.Rows - 1
TextGrid.Row = X%
TextGrid.Col = 0
Printer.Print , TextGrid.Text;
TextGrid.Col = TextGrid.Col + 1
Printer.Print , TextGrid.Text
Next X%

End Sub

One problem with the method shown above is that the song titles are not
always correctly aligned. But I would like to be able to include some other
formatting as well, so it would be easiest to send it directly to either a
text file (which I could pick up in Word) or to a Word file.
Can anyone give me a clue as to how I go about this?

Phil Benson
Jul 17 '05 #1
7 5701
On Fri, 25 Jun 2004 13:44:23 GMT, "MouseHart" <Mo*******@trap.net>
wrote:
I have written a small VB program which lists my music files on my computer,
but I
can't get it to print exactly the way I want it to. The data is viewed on
screen in
an MSFlexGrid named "TextGrid" and the following code will send it to a
printer, but I was hoping to be able to send it to either a text file or
directly to a Word for Windows file.

Private Sub Command34_Click()
Dim X%

For X% = 0 To TextGrid.Rows - 1
TextGrid.Row = X%
TextGrid.Col = 0
Printer.Print , TextGrid.Text;
TextGrid.Col = TextGrid.Col + 1
Printer.Print , TextGrid.Text
Next X%

End Sub

One problem with the method shown above is that the song titles are not
always correctly aligned. But I would like to be able to include some other
formatting as well, so it would be easiest to send it directly to either a
text file (which I could pick up in Word) or to a Word file.
Can anyone give me a clue as to how I go about this?


It would be more sensible to send it to the Printer
- since that is where you want it to go in the end

You are missing positioning the fields
Printer.CurrentX = ....
Jul 17 '05 #2
Although the ultimate destination may be the printer, I still wonder if
there is a way to send it to a file. That information would be useful to me
for future reference, in case I wanted to export the data instead of print
it. I will take your advice on positioning the fields, though. I was not
aware of that command. Thanks.
"J French" <er*****@nowhere.com> wrote in message
news:40***************@news.btclick.com...
On Fri, 25 Jun 2004 13:44:23 GMT, "MouseHart" <Mo*******@trap.net>
wrote:
I have written a small VB program which lists my music files on my computer,but I
can't get it to print exactly the way I want it to. The data is viewed onscreen in
an MSFlexGrid named "TextGrid" and the following code will send it to a
printer, but I was hoping to be able to send it to either a text file or
directly to a Word for Windows file.

Private Sub Command34_Click()
Dim X%

For X% = 0 To TextGrid.Rows - 1
TextGrid.Row = X%
TextGrid.Col = 0
Printer.Print , TextGrid.Text;
TextGrid.Col = TextGrid.Col + 1
Printer.Print , TextGrid.Text
Next X%

End Sub

One problem with the method shown above is that the song titles are not
always correctly aligned. But I would like to be able to include some otherformatting as well, so it would be easiest to send it directly to either atext file (which I could pick up in Word) or to a Word file.
Can anyone give me a clue as to how I go about this?


It would be more sensible to send it to the Printer
- since that is where you want it to go in the end

You are missing positioning the fields
Printer.CurrentX = ....

Jul 17 '05 #3
On Sat, 26 Jun 2004 04:21:27 GMT, "MouseHart" <Mo*******@trap.net>
wrote:
Although the ultimate destination may be the printer, I still wonder if
there is a way to send it to a file. That information would be useful to me
for future reference, in case I wanted to export the data instead of print
it. I will take your advice on positioning the fields, though. I was not
aware of that command. Thanks.


Channel = FreeFile
Open "Test.dat" For Output As #Channel
For L9 = 1 To Max
Print# Channel, ItemOne; ' <- note ';'
Print# Channel, vbTab
Print# Channel, ItemTwo
Next
Close# Channel
Jul 17 '05 #4
Thanks a lot. Once again, commands I could not find in my book.

"J French" <er*****@nowhere.com> wrote in message
news:40***************@news.btclick.com...
On Sat, 26 Jun 2004 04:21:27 GMT, "MouseHart" <Mo*******@trap.net>
wrote:
Although the ultimate destination may be the printer, I still wonder if
there is a way to send it to a file. That information would be useful to mefor future reference, in case I wanted to export the data instead of printit. I will take your advice on positioning the fields, though. I was notaware of that command. Thanks.


Channel = FreeFile
Open "Test.dat" For Output As #Channel
For L9 = 1 To Max
Print# Channel, ItemOne; ' <- note ';'
Print# Channel, vbTab
Print# Channel, ItemTwo
Next
Close# Channel

Jul 17 '05 #5
On Sun, 27 Jun 2004 04:07:08 GMT, "MouseHart" <Mo*******@trap.net>
wrote:
Thanks a lot. Once again, commands I could not find in my book.


Don't you have a Help System ?

Some people use the VB5 Help file

Oddly enough I keep a backup copy of that file at:

www.jerryfrench.co.uk/utils/vb5help.zip (all lowercase)


Jul 17 '05 #6
Thanks again, and no, I don't have the VB6 Help files. The Enterprise
Edition requires separate purchase of the MSDN collection, and I don't have
it. I appreciate the use of the VB5 Help, however. I'm sure it will be
fine for anything I need (until I actually learn what I'm doing, which could
be quite a while).

"J French" <er*****@nowhere.com> wrote in message
news:40****************@news.btclick.com...
On Sun, 27 Jun 2004 04:07:08 GMT, "MouseHart" <Mo*******@trap.net>
wrote:
Thanks a lot. Once again, commands I could not find in my book.


Don't you have a Help System ?

Some people use the VB5 Help file

Oddly enough I keep a backup copy of that file at:

www.jerryfrench.co.uk/utils/vb5help.zip (all lowercase)

Jul 17 '05 #7
> Thanks again, and no, I don't have the VB6 Help files. The Enterprise
Edition requires separate purchase of the MSDN collection, and I don't have it.


Unless something has changed (and I doubt it has), the Enterprise
Edition of Visual Basic (as well as Visual Studio) comes with the MSDN
files on a separate set of CD's; you should have gotten them with your
purchase. You can view the entire MSDN online at this link...

http://msdn.microsoft.com/library/default.asp

Specifically, open the "tree" to this...

Visual Tools and Languages
Visual Studio 6.0
Visual Basic 6.0
Product Documentation
Reference
Language Reference

The direct link to the Reference branch (Language Reference is under
this) is...

http://msdn.microsoft.com/library/en...LROverview.asp

The direct link to the Visual Studio 6.0 branch is...

http://msdn.microsoft.com/library/en.../vb6anchor.asp

Rick - MVP

Jul 17 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: MouseHart | last post by:
I have a small program which lists my music files on my computer, but I can't get it to print exactly the way I want it to. The data is viewed in an MSFlexGrid named "TextGrid" and the following...
9
by: Sandy | last post by:
can mfc application, send text data to opened notepad file in desktop?(live transfer of data) . can anybody help
9
by: Miro | last post by:
VB 2003 at the end of the code, this works great. bytCommand = Encoding.ASCII.GetBytes("testing hello send text") udpClient.Send(bytCommand, bytCommand.Length) and this recieves it Dim...
0
by: Andrea | last post by:
Hi I've having a very strange problem using the SendInput API to send text to other applications. I've written the code and it seems to work well. I discovered a strange problem: when I try to...
13
by: liujiaping | last post by:
Hi, all. I have a dictionary-like file which has the following format: first 4 column 7 is 9 a 23 word 134 .... Every line has two columns....
4
by: shelley_2000 | last post by:
What is the best approach to collect and load Employee Resume Data from External Employees who may not have Microsoft access? If is likely they will have Microsoft Word, but not Microsoft Access. ...
1
by: the_ricka | last post by:
Hi all, I'm fairly new to python, but very excited about it's potential. I'm trying to write a simple program that will accept input from a command line and send email. The parameters I used on...
2
by: Alex Bryan | last post by:
Okay, so what I want to do is connect to dictionary.com and send the website a word, and later receive the definition. But for now, I want to focus on sending the word. A good guy from this mailing...
0
by: saijin | last post by:
I'm planning to call a list of data from an XML file but when I duplicate the content inside the <data></data> it is not showing anything Here's the ActionScript 3.0 import...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.