Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Creating MS Word Doc from ASP


Message #1 by lipei@p... on Mon, 18 Dec 2000 05:05:41 -0000
hi...



currently, i am trying to create MS Word document using ASP....



and the browser always got error message that the line



Set objWordDoc = CreateObject("Word.Document")



has problem...



some kind of calling  is rejected by callee



can anybody have the solution.....



thanks

regards

lipei





here is the coding



<%

theTemplate="C:\Inetpub\wwwroot\AdmissionRegistration\ReportGenerator\theTemplate.dot"





	Set objWordDoc = CreateObject("Word.Document")

	objWordDoc.Application.Documents.Add theTemplate, False

	objWordDoc.Application.ActiveWindow="Schedule C Report"

	objWordDoc.Application.Visible=True

	

	Set rngCurrent = objWordDoc.Application.ActiveDocument.Content

	Set tabCurrent = 

ObjWordDoc.Application.ActiveDocument.Tables.Add(rngCurrent,5,4)

	tabRow=1

	For j = 1 to 5

	objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Borders.Enable=False



	objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(1).Range.InsertAfter

"Wong Li Pei"

	objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(2).Range.InsertAfter

"Wong Li Pei"

	'objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(3).Range.InsertAfter

 FormatCurrency("Wong Li Pei")

	objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(3).Range.InsertAfter

 "Wong Li Pei"

	objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.InsertAfter

"Wong Li Pei"

	objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(4).Range.InsertAfter

Chr(10)

	objWordDoc.Application.ActiveDocument.Tables(1).Rows(tabRow).Cells(3).Range.ParagraphFormat.alignment=2



	tabRow=tabRow+1

	Next





objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertAfter(Temp)



objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertAfter("

")

objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertAfter("

")

objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertAfter("Regards,")



objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertAfter("

")

objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertAfter("Daryl

B. Morticum")

objWordDoc.Application.ActiveDocument.Paragraphs.Add.Range.InsertAfter("Sales

Associate")



%>





---

MaximumASP offers enhanced hosting solutions on the Windows 2000 platform. Dedicated processor, RAM, and server resources provide
dedicated server performance at virtual server prices. Commercial components provided; custom components allowed.

---

You are currently subscribed to asp_web_howto as: $subst('Recip.EmailAddr')

To unsubscribe send a blank email to leave-asp_web_howto-$subst('Recip.MemberIDChar')@p2p.wrox.com


  Return to Index