Results 1 to 13 of 13

Thread: Printing from a Res file

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    158

    Printing from a Res file

    To extract a file from a res file u use the code
    Code:
     sBuffer = StrConv(LoadResData("Easy", "CERTIFICATES"), vbUnicode)
            Open App.Path & "\Easy.DOC" For Output As #1
            Print #1, sBuffer
    then
    Code:
    'Kill App.Path & "\Easy.DOC"
    to close the file

    but all that does it loads the file but doesnt print it
    how do i print it
    thanks Trav

  2. #2
    Frenzied Member Rick Bull's Avatar
    Join Date
    Apr 2002
    Location
    England
    Posts
    1,444
    What do you mean by "Print"? What you're doing there is outputing/writing the text to the file App.Path & "\Easy.DOC". I may be misunderstanding you here, but why are you using Kill, should you use Close #1 to close the file? Kill just deletes the file you have just created.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    158
    yeaa i know that the kil command deltes the file and the close command stops it


    but how do i actually print

    that code only opens the file but doesnt print it

    do u know how to make it print

  4. #4
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    By "Print," do you mean print to printer or print to the file?


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    158
    print to the printer
    do u know how to do it

  6. #6
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    VB Code:
    1. Dim ws As New Word.Application
    2. Dim wa As Word.Document
    3. Buffer = StrConv(LoadResData("Easy", "CERTIFICATES"), vbUnicode)
    4. Open App.Path & "\Easy.DOC" For Output As #1
    5.     Print #1, sBuffer
    6.     ws.Visible = False
    7.     Set wa = ws.Documents.Open(App.Path & "\Easy.DOC")
    8.     wa.Activate
    9.     ws.PrintOuts
    10. Close #1
    11. Kill App.Path & "\Easy.DOC"


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  7. #7
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    You need to add the reference "Microsoft Word 8.0 Object Library" in Project|References.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    158
    i cant find the tlb file in object libary for ms word

    can u zip it pls and send it to me

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    158
    dont worry found it
    i have 10.0

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    158
    it doesnt like the code

    printout

  11. #11
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    1 |) 0 |\| ' 7 |< |\| 0 \/\/ 1 F 10.0 1 5 7 |-| 3 5 /-\ |\/| 3.

    Try it and see if it works. I don't know if 10.0 is the same.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  12. #12
    Frenzied Member Microbasic's Avatar
    Join Date
    Mar 2001
    Posts
    1,402
    Sorry then...I don't have office XP...and giving you my TLB won't help a bit.


    MicroBasic
    Dragon Shadow Trainer

    There is no good or evil in the world...only programmers and fools .

  13. #13

    Thread Starter
    Addicted Member
    Join Date
    Mar 2002
    Posts
    158
    thanks heaps for your help

    Trav

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width