Word OLE Automation with Microsoft Offoce 365

Klaus_123 1 Reputation point
2021-01-28T12:25:26.867+00:00

We are developing software with word-automation calling winword by ole-Connection.
Excample: wordapp:=CreateOleObject('Word.Application')

This works fine with office 2010, 2013, 2016, 2019 but it doesn't work with microsoft office 365.

Customers even told us, that there is no winword.exe starting by calling winword.exe with then commandline from windows startmenu.

Is there no automation interface in office365 and all programm with word-automation have to die?

We need help to connect with word under office365

Developer technologies | Visual Basic for Applications
{count} votes

2 answers

Sort by: Most helpful
  1. Tom van Stiphout 1,861 Reputation points MVP Volunteer Moderator
    2021-01-28T13:58:35.303+00:00

    That is certainly not generally true.
    For example I am running this VBA code from Access:
    Dim o As Object
    Set o = CreateObject("Word.Application")
    Debug.Print o Is Nothing
    Set o = Nothing

    It prints "False", proving the object was created. Both Word and Access are Office 365.
    What you are seeing may be a bitness issue, or it can be a sandbox issue. You did not say what kind of app yours is.

    0 comments No comments

  2. Klaus_123 1 Reputation point
    2021-01-28T15:54:11.113+00:00

    it's a delphi-application.

    Here some code to find the word-version:

    function GetInstalledWordVersion: string;
    var
    word: OLEVariant; s:string;
    begin

     try
    

    word := CreateOLEObject('Word.Application');
    except wordversion:=' Kein Word installiert'; word:=unassigned; exit; end;

    s:=inttostr(word.version);

    if ( pos('.',s)=0 ) and (length(s)>2) then
    s:=copy(s,1,2)+'.'+copy(s,3,1);
    result := s;
    wordversion:=s; // Globale Variable
    word.Quit;
    word := UnAssigned;

    end;

    The result ist "Kein Word installiert".

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.