1. Douglas Ross
  2. PowerBuilder
  3. Wednesday, 3 March 2021 19:35 PM UTC

I just switched to PB2019 R3 from R2. 

Our app is a simple client server app.

Now when i try to use OLE to Word, it fails on the .ADD

                              ole_1.Documents.Add(as_template)

We are using 64 bit Microsoft Office - Word but that doesn't seem to be the problem since the older Test app and Production App on the same machine (built with the 2019 R2) open the word doc successfully.

So it seems the only difference is the R3.

Has anyone else seen this? Is there a work-around or will I have to go back to PB 2019 R2, if that's the problem?

Thank you,

Doug

Douglas Ross Accepted Answer Pending Moderation
  1. Friday, 5 March 2021 18:44 PM UTC
  2. PowerBuilder
  3. # 1

Thanks guys,

This is now officially bug 6214 in Appeon.

A work-around is to use ConnectToNEWObject() instead of ConnectToObject() and then to use 

documents.Open( template_name)

         instead of

documents.ADD( template_name )

<<<< Note: I added the 's' to Document.Open and Document.Add. This was a typo that Mark Goldsmith noticed. see below >>>>

Comment
  1. John Fauss
  2. Friday, 5 March 2021 19:06 PM UTC
Thanks for posting the work-around, Douglas!
  1. Helpful
  1. Douglas Ross
  2. Friday, 5 March 2021 19:40 PM UTC
Yes, Chris Pollach figured that out. We can both thank him. :)
  1. Helpful
  1. Mark Goldsmith
  2. Friday, 5 March 2021 19:58 PM UTC
Hi Doug,

I too am using ConnectToNewObject and the ConnectToObject functions. I use Open to open a template document if I want to modify the template and I use Add to open a new document based upon that template...but I can currently use both. I am also able to connect with Excel as well without any issues in PB2019R3.

In the code you provided above, I'm thinking that should be "Documents" versus "Document" as I don't believe there are Open or Add methods for the Document object.

I'm curious to see what Appeon believes the bug to be but regardless, glad you have a work around and thanks for the update.



Regards,

Mark

  1. Helpful
There are no comments made yet.
Mark Goldsmith Accepted Answer Pending Moderation
  1. Thursday, 4 March 2021 23:47 PM UTC
  2. PowerBuilder
  3. # 2

Hi Doug,

I am successfully adding a template document to Word via OLE and it opens properly in PB 2019 R3. I can't speak specifically as to why it would work in R2 and not now for you, not seeing all your code nor knowing your environment, but I suspect something has changed which is causing that to be the case. Maybe you do have something odd going on with your install of R3 but still, I would double-check the value of as_template and that it contains a full path to the template file you're trying to open (and of course the template file is actually there).

Why a full path? It can be deceiving in that just because FileExists(as_template) returns True (it has found the file in the current directory so full path not required) doesn't mean that documents.Add(as_template) will succeed without a full path, that has previously failed for me.

If you play around with it using very simple code (IE explicitly code the full path and filename) hopefully you'll see that it works and you don't have something more serious going on.

HTH.

Regards,

Mark

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Thursday, 4 March 2021 18:34 PM UTC
  2. PowerBuilder
  3. # 3

Does this happen when running the app from the IDE?

I'm thinking that if NOT, the problem might be a missing DLL in the runtime. (with all the name changes in the runtimes, excluding the 190 number in them).

regards

Comment
  1. Miguel Leeuwe
  2. Thursday, 4 March 2021 19:03 PM UTC
When looking at your code (can't see the ticket, I suppose it's private?), I'm confused.

Are you using an visual olecontrol pasted on a window (as the name OLE_1 would make me think) or are you using an oleobject variable named ole_1, which you create using a CREATE statement.

Also why are you trying the first connecttonew with empty first parameter? The correct syntax is the one with "Word.Application"?

I've got office 365 32 bit and 2019 R3 installed, so if you want I'll try it out.

If it's a visual ole control that you use on a window (or userobject), then I would understand you're having problems. The PB IDE is 32 bit and your Office is 64.

regards.
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 4 March 2021 19:06 PM UTC
Oh, okay, now I see it: your first call is not ConnectToNew() but ConnectObject(). got it!
  1. Helpful
  1. Chris Pollach @Appeon
  2. Thursday, 4 March 2021 19:52 PM UTC
Hi Miguel;

The OLE first command should not matter as Doug stated in the initial post that it worked in R2 but seems to be broken in R3.

Regards ... Chris
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 3 March 2021 21:39 PM UTC
  2. PowerBuilder
  3. # 4

Hi Douglas;

  FWIW:  I just checked the Support Database and I cannot locate any tickets around this issue. If you have a reproducible Test Case, please open a Support Ticket for this issue.

Regards ... Chris

Comment
  1. Douglas Ross
  2. Thursday, 4 March 2021 17:36 PM UTC
OK, Thank you Chris
  1. Helpful
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.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.