Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Excel to prn

I am trying to create a prn file from Excel cell values...The cells are number formated to two decimal places...The prn file needs to have 2 spaces then an 8 digit number (from the cell values), followed by another 2 spaces and another 8 digit number (also from the cell values)...Excel can't seem to give me the required 2 spaces for the text file...I am using visual basic 6 as a user interface...Still in the process of learning...
0
kmckinney6
Asked:
kmckinney6
  • 5
  • 4
1 Solution
 
criCommented:
Do not quite understand what you mean with '8 digit number'. How do you want 1234.56 to be formated ? 00001234 ? 00001235 ? 00123456 ? 12345.56xxxxxx ?

As for fixed width format. Format your cells as required. But I do not recommend it, all it takes is a header title which is too long. Where will you use this file ? Perhaps a *.csv (comma delimited, actually it is the 'list separator delimited file'). Much safer. If you state the purpose perhaps a better solution can be found.
0
 
criCommented:
Ooops. As for _space delimited_ files...
0
 
kmckinney6Author Commented:
In the worksheet, the number ranges (ex. 1234.56 to 123456.78) the cells are formatted as number with two decimal places...It has to be a *.prn file...It's use is that it will be downloaded to a flow computer...i could (i think) use notepad to make the file and chage the .txt to .prn and i think that will work...but it needs to have 2 spaces before the 8 digit number and two spaces after the number(__xxxxxx.xx__xxxxxx.xx)think of it as notepad with four columns 1st is two spaces, 2nd is a number (1 would be 000001.00 or 123456.1234 would be 123456.12)3rd column would as the 1st (2 spaces) and 4th would be as the 2nd column, the number....hope this clearifies what i need...thanks
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
kmckinney6Author Commented:
I want to see if visual basic do this automatically when i run the app....getting information from 2 columns from a worksheet to generate the prn file i described above....
0
 
criCommented:
Ok, I have a solution, but it is so kludgy you must promise to never disclose you got it from me...

Select your data area, then Format|Cells|Number|Custom 000000.00 , ok
Then select the columns and set width to 11 (8 digits + decimal points + 2 for the distance distance). If your font is too big to show on screen, reduce it or set them to shrink to fit.

Save as prn. Check it. Adapt column width if necessary. As far as I was able to determine the font size does not matter unless it results in ####.

Enjoy.
0
 
criCommented:
Consider programing your own export routine. For starters, see http://www.cpearson.com/excel/imptext.htm#Export
0
 
kmckinney6Author Commented:
I want to see if visual basic do this automatically when i run the app....getting information from 2 columns from a worksheet to generate the prn file i described above....
0
 
criCommented:
kmckinney6, do not use the 'Refresh' button, use 'Reload This Question' _link_ at the upper left.
0
 
kmckinney6Author Commented:
i think this will do it....excellent advice....maybe kludgy, but am well pleased that it worked...thanks
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now