Brian Rathburn wrote:

Have you actually assigned an instance of WordDocument to myDoc somewhere in your code. Does you app.open event (or somewhere) have: myDoc = new WordDocument ?


Jay Wooten wrote:

I ran into this a few weeks ago on a couple of computers - the following fixed the issue for us...

1) The Mac may have/have had a 'demo' copy of microsoft office on it. Trash the Microsoft Office Test Drive folder from the Applications folder.
2) Restart
3) Reinstall Office
4) Put app in Office 2004->Office folder
5) Try again.

Another thing we ran into is having variables go out of scope - no explanation here. But OLE seems to be 'sensitive' to connections.

Since myDoc is global ( or property of window/class) also make the MSWord global as well. That way it doesn't have to get created it every time the method executes.

  Sub Start_Word
     if MSWord = nil then MSWord = new WordApplication 'MSWord is Global
           if myDoc = nil then myDoc = new WordDocument

             wrdApp.Visible = True

     myDoc = MSword.Documents.Add    <<=====   Gets an OLEException

           myDoc.Activate
      exception err as oleexception
           msgbox err.message

  End Sub

- Jay

Thanks Brian and Jay for your responses.

You both mentioned that I need myDoc = new WordDocument. Examining the RS examples, to my surprise it is not used there. When I add that statement it does not compile and asks for more arguments, for which I cannot find any documentation and have no idea what that should be.

But you both missed the main point: My module with the code discussed here works fine in a small test app consisting of one window, an EditBox and a few Pushbuttons; actually, I made several, slightly more elaborate. They work ok, Word starts up opening a new document without using the line myDoc = New WordDocument. So, I assume that the .Documents.Add function is taking care of this.

My problem is, that this same module does not work in my main application. Here I get the OLEException error. Actually, continuing after the error I get the message "OLE not supported on this platform". So, what causes this? In my original post I gave a few more details of the failing environment. I have no idea where to look for the problem without tearing everything apart, which can take days.
.
Jay, I am aware of the issues you mentioned in items 1 - 5. I took care of them when I installed Office 2004 (Student-Teacher Edition). In your sample code you have a few good points which I incorporated. Thanks.

  Cheers,
  Peter


On Apr 20, 2006, at 11:28 PM, Peter E. Barck wrote:

Hi,

I have built a small Office Automation Module with a variety of Methods to start up MS Word and insert text from Editfields. All this works fine when running from a small test app with one Window, several Editfields and a Pushbutton with a call to start word

After copying this module to my main application, and moving this application into the Microsoft Office 2004/Office folder if fails to open Word. I have the following simple code:

  Sub Start_Word
     Dim MSword As WordApplication
     MSword = New WordApplication
     myDoc = MSword.Documents.Add    <<=====   Gets an OLEException

      exception err as oleexception
           msgbox err.message

  End Sub

  myDoc is  globally defined as WordDocument

The main application talks to a REALSQLServer and a local REALSQLdatabase. Has no timers nor Threads. No other ole objects; 4 windows with mostly Editfields, Listboxes, Popups and Checkboxes.

So, what could interfere with starting up MSword. How do I go about debugging this? I tried to open Word before anything else happens by calling "Start_Word" in the App Open event. Gets me the same OLEException error.

  Any help or hint is greatly appreciated!

--
   Cheers,
   Peter

    TI PowerBook G4, 1GHz, 1GB RAM, OSX 10.3.9, RB2006r2 Pro

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to