Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VERY VERY URGENT !!!!!! PLEASE PLEASE HELP ME !!!

Status
Not open for further replies.

locationsetc

Programmer
Aug 2, 2004
16
0
0
US
hello friends,

I have a web server. we are keep working on it. in our site, we have the program to send notification letter to our clients. the letter will be in MSWord document. but in order to do that, we need Word.Application component. please please tell me where we can get it ???

Thank You
locationsetc
 
Are you using visual Int dev as your developer environment.
If so go to the top menu select "project" then "project references" go down the list until you see "Micrsoft Word xx.x object library.

I hope this is what you want.

Dan
 
Word has to be installed on the server.

Basically, install MS Word on the webserver (or app server if using COM or DCOM).

Code:
Dim m_oWordApp
Dim m_oWordDoc

Set m_oWordApp= Server.CreateObject("Word.Application")
Set m_oWordDoc= m_oWordApp.Documents.Add(Server.MapPath("mytemplate.dot"))

m_oWordApp.Activate
m_oWordApp.System.Applications.Options.Pagination = True

Sub ReportHeader()

    Dim oParentTable As Word.Table
    Dim oCell As Word.Cell
    
    Set oParentTable = m_oWordApp.Selection.Tables.Add(m_oWordApp.Selection.Range, 1, 2)
    oParentTable.Id = "tblReportHeader"
    
    oParentTable.Select
    oParentTable.AllowAutoFit = True
    oParentTable.AutoFitBehavior wdAutoFitContent
    oParentTable.PreferredWidth = InchesToPoints(6.5)
    
    oParentTable.Borders.OutsideLineStyle = wdLineStyleNone
    oParentTable.Borders.InsideLineStyle = wdLineStyleNone
    
    Set oCell = oParentTable.Cell(1, 1)
    oCell.Select
    
    
    m_oWordApp.Selection.Font.Name = "Times New Roman"
    m_oWordApp.Selection.Font.Size = 34
    m_oWordApp.Selection.Font.Color = wdColorDarkBlue
    m_oWordApp.Selection.ParagraphFormat.Alignment = wdAlignParagraphLeft
    m_oWordApp.Selection.Font.Bold = True
    
    
    m_oWordApp.Selection.TypeText "Report Title" & vbCrLf
    
    Set oCell = oParentTable.Cell(1, 2)
    oCell.Select
    oCell.Column.Select
    
    Dim strAddress As String
    
    strAddress = "blah blah blah"
    
    m_oWordApp.Selection.Font.Name = "Times New Roman"
    m_oWordApp.Selection.Font.Size = 8
    m_oWordApp.Selection.Font.Color = wdColorBlack
    m_oWordApp.Selection.Font.Bold = True
    
    m_oWordApp.Selection.TypeText strAddress & vbCrLf
    
    oParentTable.PreferredWidth = InchesToPoints(6.5)
    
    
    Set oCell = Nothing
    Set oParentTable = Nothing
    

End Sub

Private Sub EndSection()
    m_oWordApp.Selection.TypeText vbCrLf
    m_oWordApp.Selection.GoToNext wdGoToLine
End Sub

Private Sub NextLine()
    m_oWordApp.Selection.GoToNext wdGoToLine
End Sub
 
And to nip somethig in the bud that will surely come up, yes you can copy the dll's from another machine with Word on it, BUT the licensing agreement for MS Word forbids this with extreme prejudice. I have heard many worse stories about people who reditrbuted the office DLLs then people who "re-used" Win NT license keys...

barcode_1.gif
 
hello Tarwn,

so, what do think what should i do at this point??

Joseph
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top