Msoffice Autoamation

Hi, I have a program that uses msoffice automation.rbx to generate and save Word files. everything works in the debug phase, once completed it does not work and gives me this error: Runtime error Please report what caused this error along with you information belove. … \ appearance.cpp: 88 Failur Condition: handleGetter
In the plugins folder I inserted the MSOfficeAutomation.rbx file copied from the EXTRAS folder, but I don’t find anything that calls it in the application’s Libs card. any ideas to solve? Thanks in advance to anyone who can help me. I use Xojo 2019 vers 3.1
Mario

Do you checked the Office Automation Word example ?

One of the ways to troubleshoot the program is to comment sections of code and then try and create a runtime file and run it. When you uncomment the line of code that causes the problem then you will get the runtime error again.
Once the line of code is known, then feel free to share it so that we can know the error also. :slight_smile:

Hi I have a few more elements. I have always tested the 32 bit program, because faster, in the end I compiled it 64 bit and the error reported in the previous post came out, or I compiled it in 32 bit and it works fine, testing it in 64 bit gives me OLEEexception errors on the following code Error -2147353571 Message Type mismetatch, (failed on “Top Margin”) Doc.PageSetup.TopMargin = 25 Doc.PageSetup.RightMargin = 55 Doc.PageSetup.BottomMargin = 25 Doc.PageSetup.LeftMargin = 55 doc.PageSetup.HeaderDistance = 20 doc.PageSetup.FooterDistance = 25 eliminating this code, another one comes out Message Type mismetatch, (failed on “Width”) perhaps related to the tables I will continue with other tests
Mario

I tried to test it with Xojo 2020 r2, it returns much more detailed errors, so I found that the document settings accept it in cm and not in mm.
doc.PageSetup.TopMargin = 2.5
doc.PageSetup.RightMargin = 5.5
doc.PageSetup.BottomMargin = 2.5
doc.PageSetup.LeftMargin = 5.5
doc.PageSetup.HeaderDistance = 2.0
doc.PageSetup.FooterDistance = 2.5
Even for the size error tables, I still don’t quite understand how he wants them
table.Columns.Item (1) .Width = 3.0
table.Columns.Item (2) .Width = 15.0
table.Columns.Item (3) .Width = 15.0
table.Columns.Item (4) .Width = 15.0
table.Columns.Item (5) .Width = 3.0
the old 150 accepts it as 15.0
the old 30 does not accept it as 3.0.
Is there any documentation?
Mario

Hello Mario,

When I worked on the Xojo Microsoft Word book, PageSetup margins were in points and I used the following command to convert inches to points for margins:

This is in Chapter 11 of my book. Likely the margins are in points, not centimeters, inches or millimeters.

Eugene, thank you for your interest and for your help
By doing some tests I finally discovered the difference between 64 bit and 32 bit.
32-bit version accepts table.Columns.Item (2).Width = 100
the 64-bit version collapses with this measure.
ok size is
table.Columns.Item (2) .Width = 100.0
and so for all other Word document sizes
Mario

1 Like