Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


[URGENT] ASP + MS Office 2003 Automation, Pls HELP

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,28732
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> [URGENT] ASP + MS Office 2003 Automation, Pls HELP
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 [URGENT] ASP + MS Office 2003 Automation, Pls HELP - 12/6/2005 7:45:35 PM   
  steve_k

 

Posts: 4
Score: 0
Joined: 12/6/2005
Status: offline
anyone know how to load a msword file using asp?
i found an old web application got this function, but it only works with msword2k, not compatible for msword2003.
the error is: activex component can't create object: 'Word.Application'
so does anyone have idea regarding how to change it to suit for both msword2k and msword2003?
pls advice. thanks.
refer to this code:
quote:

<script LANGUAGE=VBScript>
Sub ButtonClick()
on error resume next 
Dim oApp
Dim oDoc
Dim oMergedDoc
  
' Create an instance of Word.    
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
 
sServer = "<%=ServerIP%>" ' 127.0.0.1
sVDir = "<%=VDir%>"
sDataFile = "<%=strMergeFile%>" 
strDataDoc = "http://" & sServer & sVDir & "/netasset/trust/tmp/" & sDataFile
Set oDoc = oApp.Documents.Open(strDataDoc,false,true)
oDoc.Select
oDoc.SaveAs "<%=gstrLocalDocDataFilePath%>" & "<%=strDocName%>" & ".txt"
oDoc.Close False

strTemplateDoc = "http://" & sServer & sVDir & "/netasset/trust/doc/" & "<%=strDocName%>" & ".doc"
Set oDoc = oApp.Documents.Open(strTemplateDoc,false,true)
oDoc.Select
  
With oDoc.MailMerge
   ' Open the saved data source.
'strDataFile = gstrAssetDocFilePath & strDocName & ".txt"
'strDataFile = "<%=gstrAssetDocFilePath%>" & sDataFile
strDataFile = "<%=gstrLocalDocDataFilePath%>" & "<%=strDocName%>" & ".txt"
   .OpenDataSource strDataFile,4 '4 - wdOpenFormatText
   .Destination = 0  ' 0 = wdSendToNewDocument
    
   ' Execute the mail merge.
   .Execute false
End With
       
' Close the mail merge edit document.
oDoc.Close False
' Get the current document.
Set oMergedDoc = oApp.ActiveDocument
' Show Word to the user.
'oApp.Visible = True
  
' Uncomment these lines to save the merged document locally.
'oMergedDoc.SaveAs "C:\test.doc"
'oMergedDoc.Close False
'oApp.Quit False
End Sub
</SCRIPT>
 
 
Post #: 1
 
 RE: [URGENT] ASP + MS Office 2003 Automation, Pls HELP - 12/7/2005 2:57:59 AM   
  Snipah


Posts: 1343
Score: 6
Joined: 11/1/2004
From: Netherlands
Status: offline
Welcome Steve_K,

Since we are not a helpesk, we will ignore your [URGENT] statement....

Furthermore... Once you remove/comment out the On Error Resume Next, you will most likely get a error response...

Please post that response, since Office2k3 is using the same Word.Application as Office2k, we can see if the error occurs somewhere else...

_____________________________

For more information, please see the "Read me First" topic.

http://www.visualbasicscript.com

(in reply to steve_k)
 
 
Post #: 2
 
 RE: [URGENT] ASP + MS Office 2003 Automation, Pls HELP - 12/7/2005 12:17:13 PM   
  steve_k

 

Posts: 4
Score: 0
Joined: 12/6/2005
Status: offline
thanks for ur quick response

Line: 989
Char: 42
Error: Unterminated string constant
Code: 0
URL: http://myserveraddress.asp

Line: 929
Char: 4
Error: ActiveX component can't create object: 'Word.Application'
Code: 0
URL: http://myserveraddress.asp

Can i know is the 1st error generated the 2nd error?
What is the first error mean?

thanks in advance

(in reply to Snipah)
 
 
Post #: 3
 
 RE: [URGENT] ASP + MS Office 2003 Automation, Pls HELP - 12/8/2005 2:51:43 AM   
  ebgreen


Posts: 5069
Score: 31
Joined: 7/12/2005
Status: offline
Which line is line 989? Which line is 929? How in the world could we possibly know?

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to steve_k)
 
 
Post #: 4
 
 RE: [URGENT] ASP + MS Office 2003 Automation, Pls HELP - 12/13/2005 3:21:36 AM   
  csamuels


Posts: 42
Score: 0
Joined: 9/26/2005
Status: offline
line 989 is 60 past 929,  which means we dont see the unterminated string code

(in reply to ebgreen)
 
 
Post #: 5
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> [URGENT] ASP + MS Office 2003 Automation, Pls HELP Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts