Hi Warren,

> Hi! Can u give me a sample code for creating a word
> document using vb6. tks

Sure. Add a reference to the "Microsoft Word n.0 Object Library" then
add this code to a module:

'// ========================================================
Option Explicit

Sub CreateWordFile(sPath$, sContents$)
' open word
  Dim wa As Word.Application
  Set wa = New Word.Application

' create the word document
  Dim wd As Word.Document
  Set wd = wa.Documents.Add()

' make sure it has focus
  wd.Activate

' insert the content
  wd.Content.InsertAfter sContents

' save the file
  wd.SaveAs sPath
  wd.Close

' clean up
  wa.Quit
  Set wa = Nothing
End Sub
'// ========================================================

Use it like this from the Debug Window:
  createwordfile "C:\testing.doc", "Hello out there!"

Regards,

Shawn K. Hall
http://ReliableAnswers.com/

'// ========================================================
    I think, therefore I am... dangerous.




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/k7folB/TM
--------------------------------------------------------------------~-> 


'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [EMAIL PROTECTED]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to