wxAutomationObject - WORD - File association message blocking the process [SOLVED]

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
Phil-ok
Knows some wx things
Knows some wx things
Posts: 47
Joined: Tue Mar 29, 2016 6:32 am

wxAutomationObject - WORD - File association message blocking the process [SOLVED]

Post by Phil-ok » Mon Sep 19, 2016 4:57 am

Hello,
I just installed WORD 2007 on a PC (I had no other available licence for this).
When I create the instance with wxAutomationObject, Word shows a message asking to associate the application with file extensions.
I do this, but the message comes back at each new instance creation.
If I open a file manualy with Word, I have no such message.
Any idea ?
Thanks
Philippe
Last edited by Phil-ok on Mon Sep 19, 2016 1:45 pm, edited 1 time in total.

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2022
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxAutomationObject - WORD - File association message blocking the process

Post by PB » Mon Sep 19, 2016 5:21 am

When does the message pop up: Immediately after creating the application instance or when trying to open the file?
If it is the latter, have you tried to call

Code: Select all

application.PutProperty("DisplayAlerts", 0); // 0 = wdAlertsNone
prior to opening the file? What is the file extension and format (rtf, doc, docx, docm...)?

BTW, I have been using MS Word for at least two decades, cannot say I remember seeing a file extension association dialog in it. Even if you manage to suppress the dialog, there still may be something odd either in your automation code or MS Word installation.

Phil-ok
Knows some wx things
Knows some wx things
Posts: 47
Joined: Tue Mar 29, 2016 6:32 am

Re: wxAutomationObject - WORD - File association message blocking the process

Post by Phil-ok » Mon Sep 19, 2016 7:08 am

Merci
Voici le code :

Code: Select all

   wxAutomationObject application;

    application.CreateInstance("Word.Application");
    if ( !application.IsOk() )
    {
        errorMsg = _("Failed to create MS Word application instance.");
        return false;
    }
    
Il déclenche le message
mess.png
mess.png (19.47 KiB) Viewed 895 times
Philippe

PB
Part Of The Furniture
Part Of The Furniture
Posts: 2022
Joined: Sun Jan 03, 2010 5:45 pm

Re: wxAutomationObject - WORD - File association message blocking the process

Post by PB » Mon Sep 19, 2016 7:26 am

(I do not understand the message in the dialog, but I suppose it says what you wrote in the OP)

Sorry, I have no idea except it must be something wrong with your MS Word/Office install.
So you say the dialog is never displayed when launching MS Word from using its shortcut or via shell using .doc file? Are the file associations set properly and are there no permission issues, e.g. launching MS Word with different rights (or command line parameters) manually then when automation it?

Just to make sure it is not wxWidgets related (which is highly unlikely IMO), please try to automate Word with VBS, i.e. create test.vbs file containing

Code: Select all

Set objWord = CreateObject("Word.Application")
objWord.Visible = True
and observe whether the dialog is displayed or not.

Phil-ok
Knows some wx things
Knows some wx things
Posts: 47
Joined: Tue Mar 29, 2016 6:32 am

Re: wxAutomationObject - WORD - File association message blocking the process

Post by Phil-ok » Mon Sep 19, 2016 11:43 am

Thanks,
I have the same problem with VBA.
It seems the automation tries to start Word 2013 (I didn't know it was installed) for which I have no licence.
Philippe

Phil-ok
Knows some wx things
Knows some wx things
Posts: 47
Joined: Tue Mar 29, 2016 6:32 am

Re: wxAutomationObject - WORD - File association message blocking the process

Post by Phil-ok » Mon Sep 19, 2016 1:42 pm

Hello,
With now only Word 2007 on the PC, everything runs great !
Thanks a lot.
Philippe

Post Reply