Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Importing / Linking / August 2005

Tip: Looking for answers? Try searching our database.

Automating Word

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Stanley - 26 Aug 2005 20:13 GMT
I'm trying to automate word; at first, with very simple code:

********
Sub automateWord()
   
  Dim wordApp As Word.Application
   
  ' Create new hidden instance of Word.
  Set wordApp = New Word.Application
  ' Show this instance of Word.
  wordApp.Visible = True

   With wordApp
       ' Code to automate Word here.
   End With
   
   wordApp.Quit
   Set wordApp = Nothing
End Sub
************

I have set a reference to the Word Object Library.

When the code encounters the "Set" statement, I get the following error
message:

"Run-time error '-2147221231 (80040111)

Automation Error
ClassFactory cannot supply requested class"

If I substitute Excel for Word, everything works as expected.

What am I missing here?

Signature

Thank you for your help

Bill

John Nurick - 27 Aug 2005 06:52 GMT
Hi Bill,

I don't think you're missing anything. This code should work (does work
on my system). Searching groups.google.com suggests that this is an
uncommon problem caused by something having gone wrong with your Word or
Office installation. Out of curiosity I'd try
    Set WordApp = CreateObject("Word.Application")
but I wouldn't expect it to work differently.

For a fix, the first thing I'd try is to re-register Word by running
    winword /r

If that doesn't do the job, after that, run Office Setup and repair the
installation. After that, uninstall and re-install Office.

There's one newsgroup thread that suggests (but does not prove) a link
between this problem and Norton Antivirus 2004.

>I'm trying to automate word; at first, with very simple code:
>
[quoted text clipped - 30 lines]
>
>What am I missing here?

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.