Could you attach a sample word doc?

Adam Wayne Lehman
Web Systems Developer
Johns Hopkins Bloomberg School of Public Health
Distance Education Division


-----Original Message-----
From: Jeff Garza [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, January 22, 2003 6:24 PM
To: CF-Talk
Subject: CFMX and Office Automation

Has anyone gotten CFMX to do anything more than open Word and close
it???

I'm trying to access some fields within a Word doc and pump them to a
database and I'm running into serious problems.

I'm running CFMX Developer (Enterprise) with Updater 2 applied
Accessing Word 2000

<CFSET pathToDoc = "D:\Inetpub\wwwroot\Office\Docs\WordForm.doc">
<CFSCRIPT>
// Create an instance of Word on the server
objWord = CreateObject("COM", "Word.Application");
objWord.visible = false;
// Get the Word document you need to open 
objDoc = objWord.Documents.open(pathToDoc);

/* Get all fields within the document */
FirstName = objDoc.FormFields["FirstName"].Result; **** Fails Here! ***
LastName = objDoc.FormFields["LastName"].Result;

// Show Output variables, or lack thereof...
WriteOutput("Finished Opening and Closing " & pathToDoc & "
Successfully... <BR>");
WriteOutput("FirstName = " & FirstName & "<BR>");
WriteOutput("LastName = " & LastName & "<BR>");

// Object Cleanup...
objDoc.close();
objWord.quit();
</CFSCRIPT>

Error is below:

      An exception occurred when accessing a Com object field.  
      The cause of this exception was that:
coldfusion.runtime.java.MethodSelectionException: Method selection
Exception..  
        
      The error occurred in
D:\Inetpub\wwwroot\Office\getValues_Server.cfm: line 10
     
8 : 
9 : /* Get all fields within the document */
10 : FirstName = objDoc.FormFields["FirstName"].Result;
11 : LastName = objDoc.FormFields["LastName"].Result;
12 : 

     

Any takers???

Jeff


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to