is there any way to write to a doc file and give formating to that file and also to print that file. if yes pls reply soon
Printable View
is there any way to write to a doc file and give formating to that file and also to print that file. if yes pls reply soon
Yes.
You can use Word to record a macro and do your desired action and it will generate module code which you an almost use without any conversion in vb6.
You can use the Word Object Model. Add a reference to MS Word xx.0 Object Library and start with code like so.
VB Code:
Option explicit 'add reference to ms word xx.0 object library private sub command1_click() dim oApp as word.application dim oDoc as word.document set oapp = new word.application set odoc = oapp.documents.open("C:\Test.doc") 'Do your writting stuff. '... 'Do your printing. oapp.documents("Test.doc").PrintOut odoc.close set odoc = nothing oapp.quit set oapp = nothing End sub