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

Export to word template??

Status
Not open for further replies.

DanKon

Programmer
Joined
Aug 22, 2002
Messages
5
Location
US
As part of my current project, I need to be able to generate invoices that the client can print locally on their machine. The data resides in MS SQL Server on our Server and ideally, I'd like to allow the user to select the customers for whom he/she wants to generate invoices and insert the data into an MS Word template. Is this possible? Is there a 3rd party activex control i could purchase to accomplish this? Maybe I could export to excel and create a word macro that would accomplish it? If anyone has any suggestions, I will love you forever :)

Dan
 
Hold on, and i'll show you how to do this. www.vzio.com
ASP WEB DEVELOPMENT



 
Ok here you go..
Code:
<%
Dim strSavePath

Set MyWord = CreateObject(&quot;Word.Application&quot;)
MyWord.Application.Documents.Open &quot;c:\inetpub\[URL unfurl="true"]wwwroot\bla.doc&quot;[/URL]

'# Find text to &quot;Replace&quot;
MyWord.ActiveWindow.Select.Goto -1,,, &quot;Text1&quot;

'# Write something
MyWord.ActiveWindow.TypeText &quot;Write Something in place of Text1&quot;

strSavePath = &quot;c:\inetpub\[URL unfurl="true"]wwwroot\bla2.doc&quot;[/URL]

MyWord.ActiveDocument.SaveAs strSavePath

Set MyWord = Nothing

%>
www.vzio.com
ASP WEB DEVELOPMENT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top