Join The Works program to have access to the most current content, and to be able to ask questions and get answers from Revelation staff and the Revelation community

At 30 SEP 2006 01:20:15PM jhenry wrote:

Been having good success in building a spreadsheet in Excel using the Ole… interfaces until I hit this snag:

The Excel documentation uses the constant 'false' to set the Zoom property on the PageSetup object. Once this is done, then setting the the 'FitToPagesWide' and 'FitToPagesTall' to 1 should fit the entire spreadsheet on on page when printed.

As near as I can tell, 'false' is 0 (zero). Problem is, it throws an error when the following syntax is used. I've also tried 1, 2, -1 and -4142 as values for false.

Any ideas??

* This doesn't work

equ xlFalse to 0

OlePutProperty( xlPageSetup , 'Zoom' , xlFalse ) ;* error

a=OleStatus()

OlePutProperty( xlPageSetup , 'FitToPagesWide' , 1 ) ;* ignored

if OleStatus() then GOTO HadError

a=OleStatus()

OlePutProperty( xlPageSetup , 'FitToPagesTall' , 1 ) ;* ignored

if OleStatus() then GOTO HadError

a=OleStatus()

TIA

John Henry


At 02 OCT 2006 09:52AM John Bouley wrote:

Instead of using OlePutProperty have you tried OleCallMethod. I was trying to do a similar operation with Word on what I thought was a property. Turns out it was really a method…

HTH,

John


At 02 OCT 2006 12:10PM jhenry wrote:

No joy trying the OleCallMethod for 'Zoom'.

The zoom does change when using OlePutProperty and parameters in the range specified in the Excel help.

Thanks for the help!

John


At 03 OCT 2006 09:11AM Bob Carten wrote:

Hi John

Does this work as a macro in Excel?

My usual strategy is to use the macro recorder in excel, get my code working, Open the Excel Vba editor, then translate to OI. Often the macros use constants like xlWhatever. To find the value of the constant, use the immediate window at the bottom of the VBA editor.

Type ?xlWhatever

Excel will return the value of the constant.

HTH

Bob


At 03 OCT 2006 02:53PM jhenry wrote:

Hi Bob,

I'be been using the macro recorder and have gotten a long way into the Excel world. The problem I'm having with this guy is that the immediate window returns this interesting value for false:

?false

False

likewise

?true

True

I'm starting to think that we're not supposed to know the real value of true and false!

Thanks

John Henry


At 04 OCT 2006 08:48AM Bob Carten wrote:

I'm starting to think that we're not supposed to know the real value of true and false!

Stick with their plan, You'll be ready for elected office soon.

You can use -1 or 1 for true

You can use 0 for false


At 04 OCT 2006 01:41PM jhenry wrote:

I've tried 0 (and several other values) and it throws an error for all of them. So it appears there is an 'anomaly' in the Excel world.

I'm building a cross-tab report in Excel then doing a bunch of formatting, header, graphic in the header, border and several other things and this is the only one that has 'fallen over' so I'll leave it at that for now.

Thanks

John


At 04 OCT 2006 03:59PM Karen Oland wrote:

Did you try sending it the word "false" in the same case shown in the display?


At 05 OCT 2006 08:52AM jhenry wrote:

No joy with 'false' either…

Looks like I might actually have to read the first couple of chapters of the 'Programming Excel….' book!

John Henry

View this thread on the Works forum...

  • third_party_content/community/commentary/forums_works/4b3b03c76d0fde49852571f9005f3cf9.txt
  • Last modified: 2023/12/30 11:57
  • by 127.0.0.1