Highlighted
Absent Member.
Absent Member.
504 views

[archive] Need some help translating vb to cobol

[Migrated content. Thread originally posted on 13 February 2007]

I want to adjust the pagesetup and set Zoom to false but I get a compiler error. When I set it to zero (Zoom = 0) then excel crashes.

Help me please.

With ActiveSheet.PageSetup
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1

modify olWrkSh @PageSetup::PaperSize = xlPaperA4,
@PageSetup::FitToPagesWide = 1,
@PageSetup::FitToPagesTall = 1,
@PageSetup::FirstPageNumber = xlAutomatic,
@PageSetup::Order = xlDownThenOver,
@PageSetup::Zoom = False.

* Zoom
PROPERTY-GET, 663, @Zoom
RETURNING "VARIANT", TYPE 12
* Zoom
PROPERTY-PUT, 663, @Zoom,
"VARIANT (Property Value)", TYPE 12
0 Likes
6 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Need some help translating vb to cobol

Microsoft documentation states that the Zoom property may only bet set to a value between 10 and 400. If you do not want zoom, I suggest you do not set it, e.g. take it out. It is also stated that if the parent object is a chart, Zoom is not a valid property.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Need some help translating vb to cobol

If I do not set Zoom then it is still selected in the pagesetup dialog and I want the field "adjust to" to be selected.

Andre
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Need some help translating vb to cobol

I found this article http://mail.python.org/pipermail/python-win32/2002-April/000337.html
However pywintypes can't be found in excel.def

Andre
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Need some help translating vb to cobol

Interesting, while seemingly irrational, there might be a rationale behind it. Languages that support the bool type will presumably distinguish between 0 and false, and for that matter true and 1, albeit we as human beings will consider it the same.
The difference is in that these are passed differently.
A 0 will typically be passed as a VT-I2, while a false will be passed as VT-BOOL.
The recepient (any correct programmed COM anyway) will before it attempts at the value of a variant, check the type. Say in this case then, it will check the type, see that it is a VT-I2 it will then look for a number in the aforementioned range. As in this case it is outside the range, and there are no error testing it runs into a mav.
On the contrary, if the COM type being passed was a VT-BOOL and this was detected, the zoom feature would be turned off rather than its value being used for a purpose it was not meant for.

So, try this:

modify olWrkSh @PageSetup::Zoom = 0 AS VT-BOOL
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Need some help translating vb to cobol

Yes it works. I created the field like this.
78 VT-BOOL VALUE 11.

I took the course but find it still difficult stuff but 'm learning all the time.

Thanks a lot.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Need some help translating vb to cobol

Good work!

Btw, the variant constants (VT-BOOL etc) are defined in the standard def directory in the copy book activex.def.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.