Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 234
  • Last Modified:

manipulate text

How could i adapt this code to save in a .doc 10 columns long
Open "C:\TEST.ini" For Output As #1
For X = 0 To List1.ListCount - 1
Print #1, Left(List1.List(X), 3) & vbCrLf
Next X
Close #1
0
leachim
Asked:
leachim
  • 7
  • 3
  • 2
  • +1
1 Solution
 
nigelroweCommented:
Do you mean a word document?
0
 
leachimAuthor Commented:
nigelrowe
yes
0
 
leachimAuthor Commented:
I need to put about 4000 readings from a listbox into a document 10 columns in width
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Ryan ChongCommented:
Hi leachim, Use

1. Working Directly with Objects

Dim Doc as Word.Document
set Doc = CreateObject("Word.Document")
...do the loop...
Doc.PrintOut
Doc.SaveAs filename
Set Doc = Nothing

OR

2. Working Through the Application
Dim WordApp as Word.Application
Dim Doc as Word.Document
Set WordApp = new Word.Application
Set Doc = WordApp.Documents.Add
...do the loop...
Set Doc = Nothing
Set WordApp = Nothing
0
 
leachimAuthor Commented:
my apologies i should have said wordpad.doc
0
 
nigelroweCommented:
Top to bottom, not left to right?
0
 
leachimAuthor Commented:
left to right
0
 
leachimAuthor Commented:
0
 
leachimAuthor Commented:
NigelRowe
humble apologies i have not found the answer as claimed above
would be appreciative of your comments
0
 
nigelroweCommented:
No problem, I didn't have time to get back to you as I'm at work.

You could also use a ListView control.

The WINAPI Looks ok to me, you just have to output the listbox entries line by line into a file, and I'm sure you know how to do that. If you're satisfied now, you should delete this question.

Bye
0
 
rspahitzCommented:
Presonally, I'd dump it out as a tab-delimited file and load in as needed.
0
 
rspahitzCommented:
Ohhhh.  I guess that was a really bad answer if it only got a C-grade (:@)

Did you want a procedure to do that?
0
 
leachimAuthor Commented:
rspahitz
if you have the time a proceedure would be good
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 7
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now