1. Gregory Rusak
  2. PowerBuilder
  3. Thursday, 17 October 2019 00:21 AM UTC

Hello Community,

PowerBuilder 2019 R

All Versions of Word

Does anyone have any feedback on why it is that if you open a Microsoft Word Macro-Enabled Template (.dotm) from Windows File Explorer, that you get the expected Security Warning message as follows:

But if you use OLE Automation in PowerScript for example (and sending Edit/0 as the Verb - have tried others):

li_return = dw_enblob_word.OLEActivate(ll_enblob_row, 'word_blob', 0)
IF li_return  < 0   THEN
 PopulateError(100, 'Unable to OLEActivate')
 gnv_app.of_app_error()
 RETURN FAILURE
END IF

It appears that the Security Warning (and button to enable Content) does NOT appear:

Any ideas are greatly appreciated.

Greg

Accepted Answer
Gregory Rusak Accepted Answer Pending Moderation
  1. Friday, 18 October 2019 16:37 PM UTC
  2. PowerBuilder
  3. # Permalink

Hello Community,

So as a test, we used Microsoft Access and dropped an OLE control with this Word document on a form and activated it by double-clicking, and the Security Warning message does NOT appears as well, so I think this is not a PB related OLE issue and we'll check the Microsoft Forums as per Armeen's suggestion.

Thanks all.

Greg

Comment
  1. John Fauss
  2. Friday, 18 October 2019 19:08 PM UTC
If you find an answer, please share it with us?

Thanks!
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 18 October 2019 13:03 PM UTC
  2. PowerBuilder
  3. # 1

Hi Gregory;

  FWIW: In the past decade MS has really tightened the Outlook system to stop email bots from spamming these type of systems. I suspect that this "tightening" down of the email system will continue. For the customers that I have worked with in this time period, I have recommended using SMTP instead and this has solved these type of recurring mail client issues. Even when using PowerServer based Apps, I had the applications call a Web Service that in turn used SMTP to send mail.

  Food for thought.

FYI:  http://www.topwizprogramming.com/freecode_emailsmtp.html

Regards ... Chris

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Friday, 18 October 2019 03:48 AM UTC
  2. PowerBuilder
  3. # 2

If you have not already done so, I suggest you post your issue on MS Word discussion forum(s), focusing on the Word Object Model and OLE, as I still believe the issue is a Word issue.

Good Luck!

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 18 October 2019 00:30 AM UTC
  2. PowerBuilder
  3. # 3

From the help on OleActivate():

The verb you specify determines what action occurs when the OLE server application is invoked. The default verb (0) generally means you want to edit the document. Each OLE application has its own particular set of supported verbs. To find out what verbs the application supports, consult the documentation for the application, or look for the application name in the HKEY_LOCAL_MACHINE\SOFTWARE\Classes section of the Windows registry and find its Protocol\ StdFileEditing\Verb key. For example, the AVIFile class has three verbs, 0, 1, and 2, for Play, Edit, and Open

 

I've tried to look for anything that looks like that 'protocol' but only see guids. (maybe I should look to what they point though ..)

Try to see what happens if you pass a 1, 2, 3 ... to OleActivate() instead of 0 ?

Comment
There are no comments made yet.
Gregory Rusak Accepted Answer Pending Moderation
  1. Thursday, 17 October 2019 23:51 PM UTC
  2. PowerBuilder
  3. # 4

Hello Armeen, Thanks for the quick response.

Tried that with the same result. No Security Warning:

Anything else?

 

Thanks

Comment
  1. Armeen Mazda @Appeon
  2. Friday, 18 October 2019 16:05 PM UTC
Geez, I don't know then. I think you should try John Fauss' suggestion. I don't see this being a PB-specific issue so you can get more feedback from the Microsoft forums.
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Thursday, 17 October 2019 22:06 PM UTC
  2. PowerBuilder
  3. # 5

Hi Greg,

Try two things as troubleshooting steps and let's see if that resolves the issue:

1. In the Trust Center > Macro Settings, uncheck "Trust access to the VBA project object model"; and

2. In the Trust Center > Trusted Documents, check "Disable Trusted Documents".

Regards,
Armeen

Comment
There are no comments made yet.
Gregory Rusak Accepted Answer Pending Moderation
  1. Thursday, 17 October 2019 21:53 PM UTC
  2. PowerBuilder
  3. # 6

Hello John,

Thanks for the reply. Still not getting the notification set as follows:

Not sure if there are other settings - don't appear to be.

And as for Michael's suggestions, we are using a Modify to set the Template to that template file before calling the OLEActivate:

ls_rtn = dw_enblob_word.Modify("word_blob.Template = '" + gnv_app.inv_word_services.of_word_template_path_return() + lstr_enform_data.s_template + "'")

And it's not as if we want the macros enabled when activating the OLE object, we just want the user to see that there are in fact macros in this template file that can be enabled by the Security Warning.

Any other setting suggestions?

Thanks,

Greg

Comment
There are no comments made yet.
Michael Kramer Accepted Answer Pending Moderation
  1. Thursday, 17 October 2019 11:29 AM UTC
  2. PowerBuilder
  3. # 7

Hey,

Adding to John's reply. Does your PB integration actually edit the template or does it create a new document based on the template? This could influence the security handling.

Also, when you OLE Activate the "outer" security context flows into the contained app (Word in this case). That context is easily different that opening same app directly from Windows Explorer.

Just like John, I expect there are configuration settings impacting this difference.

HTH /Michael

Comment
There are no comments made yet.
John Fauss Accepted Answer Pending Moderation
  1. Thursday, 17 October 2019 03:37 AM UTC
  2. PowerBuilder
  3. # 8

Hi, Gregory -

I would think this behavior is controlled via some setting in Word.

A pure guess on my part as I don't know if the following addresses your issue, but you might want to check the Macro Settings in the Trust Center in the Developer tab in Word, in particular the setting named "Trust access to the VBA project object model", since OLE utilizes Word's object model.

HTH,

John

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.