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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi all, I have a Wordtemplate th

Status
Not open for further replies.

kenjoswe

Technical User
Sep 19, 2000
327
0
0
SE
Hi all,

I have a Wordtemplate that I would like to add some addressfield to from an Asp page. I have tried to convert the Worddocument to .html but the document is distorted.

How can I send variables from an Asp-page to a Worddocument?

/Kent J.
 
Kent,
It depends upon what you want to do. The Word, and all Office products for that matter, have a real cryptic object structure. But, in all cases you have to create a Word (or Excel, or Access, etc.) object to gain access to the Word functions. Once you have access to the methods you can pass variables in to the parameters of the methods.

Code:
Option Explicit

Dim g_objWord, strFileName

strFileName = "SomeFileName"

Const wdSaveChanges = -1

' Create Word object and open it
Set g_objWord = CreateObject("Word.Application")
g_objWord.Visible = True

' Place your Word code in here.

' Close document
g_objWord.Documents(strFileName).Close wdSaveChanges
' Close Word
g_objWord.Visible = False
' Kill objects
Set g_objWord = Nothing

To determine what the code is to enter in the middle, I found that the best way is to use the Word Record Macro function.

The MSDN help for Word is here:


Zy
 
Zymurgyst,

Thanks for your reply!
But do you know how I can send a variable to a WordDokument such as <%Response.write(session(&quot;CustName&quot;))%>

/Kent J.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top