From: B-Riemke on
Hi,
i have a problem with Excel 2007.

The OLE Fuction "setPrintArea" is working in all Excel Versions but
not in the Version 2007.

Have anyone test this Funkction under Excel 2007?


Best Regards

Bernd
From: Pete Dashwood on
B-Riemke wrote:
> Hi,
> i have a problem with Excel 2007.
>
> The OLE Fuction "setPrintArea" is working in all Excel Versions but
> not in the Version 2007.
>
> Have anyone test this Funkction under Excel 2007?
>
>
> Best Regards
>
> Bernd

I have been using Excel 2007 without problem from Fujitsu NetCOBOL and C#.

Can you tell us exactly how it fails? What is the COM return code? Sample
code?

I haven't used this particular function, but it obviously SHOULD work.

Does it simply not print? Have you tried print preview? Do you have object
references to Excel, the Workbook and the Worksheet all previously
established?

This SHOULD be a simple matter of telling SetPrintArea the range you want
printed then printing it.

Are you sure you are referencing the current worksheet? (If you saved it
already it may need re-referencing.)

Post your code if you want further help.

Pete.

--
"I used to write COBOL...now I can do anything."


From: B-Riemke on
On Jan 5, 11:14 pm, "Pete Dashwood"
<dashw...(a)removethis.enternet.co.nz> wrote:
> B-Riemke wrote:
> > Hi,
> > i have a problem with Excel 2007.
>
> > The OLE Fuction "setPrintArea" is working in all Excel Versions but
> > not in the Version 2007.
>
> > Have anyone test this Funkction under Excel 2007?
>
> > Best Regards
>
> > Bernd
>
> I have been using Excel 2007 without problem from Fujitsu NetCOBOL and C#..
>
> Can you tell us exactly how it fails? What is the COM return code? Sample
> code?
>
> I haven't used this particular function, but it obviously SHOULD work.
>
> Does it simply not print? Have you tried print preview? Do you have object
> references to Excel, the Workbook and the Worksheet all previously
> established?
>
> This SHOULD be a simple matter of telling SetPrintArea the range you want
> printed then printing it.
>
> Are you sure you are referencing the current worksheet? (If you saved it
> already it may need re-referencing.)
>
> Post your code if you want further help.
>
> Pete.
>
> --
> "I used to write COBOL...now I can do anything."

********************************************************
*
* Macro from Excel 2007:
* ActiveSheet.PageSetup.PrintArea = "$A$1:$EA$267"
* This is working under all versions but not under 2007
*
********************************************************

Move z"1:267" TO X-00-TEXT

INVOKE WorkBook "getActiveSheet" RETURNING ActiveSheet.

INVOKE ActiveSheet "getPageSetup" Returning PageSetup.

INVOKE PageSetup "setPrintArea" using X-00-TEXT

******************************************************
From: Pete Dashwood on
B-Riemke wrote:
> On Jan 5, 11:14 pm, "Pete Dashwood"
> <dashw...(a)removethis.enternet.co.nz> wrote:
>> B-Riemke wrote:
>>> Hi,
>>> i have a problem with Excel 2007.
>>
>>> The OLE Fuction "setPrintArea" is working in all Excel Versions but
>>> not in the Version 2007.
>>
>>> Have anyone test this Funkction under Excel 2007?
>>
>>> Best Regards
>>
>>> Bernd
>>
>> I have been using Excel 2007 without problem from Fujitsu NetCOBOL
>> and C#.
>>
>> Can you tell us exactly how it fails? What is the COM return code?
>> Sample code?
>>
>> I haven't used this particular function, but it obviously SHOULD
>> work.
>>
>> Does it simply not print? Have you tried print preview? Do you have
>> object references to Excel, the Workbook and the Worksheet all
>> previously established?
>>
>> This SHOULD be a simple matter of telling SetPrintArea the range you
>> want printed then printing it.
>>
>> Are you sure you are referencing the current worksheet? (If you
>> saved it already it may need re-referencing.)
>>
>> Post your code if you want further help.
>>
>> Pete.
>>
>> --
>> "I used to write COBOL...now I can do anything."
>
> ********************************************************
> *
> * Macro from Excel 2007:
> * ActiveSheet.PageSetup.PrintArea = "$A$1:$EA$267"
> * This is working under all versions but not under 2007
> *
> ********************************************************
>
> Move z"1:267" TO X-00-TEXT
>
> INVOKE WorkBook "getActiveSheet" RETURNING ActiveSheet.
>
> INVOKE ActiveSheet "getPageSetup" Returning PageSetup.
>
> INVOKE PageSetup "setPrintArea" using X-00-TEXT
>
> ******************************************************

That looks OK, but you haven't told us what the HResult is. That gives a
clue as to why it isn't working.

Try and forget that it works in other versions, that doesn't help the
immediate problem, which you need to see as if it were new.

It seems very likely to me that the problem is being caused by the value of
X-00-TEXT.

Have you tried setting a standard range in there like: "$A$1:$EA$267" ?

I'd try some experiments with this, like a value of "$A$1:$A$1" and see if
it will print a single cell. This will at least establish whether the
problem is in the print function or with the range specified for the
worksheet.

Pete.

--
"I used to write COBOL...now I can do anything."


From: B-Riemke on
On Jan 8, 11:09 pm, "Pete Dashwood"
<dashw...(a)removethis.enternet.co.nz> wrote:
> B-Riemke wrote:
> > On Jan 5, 11:14 pm, "Pete Dashwood"
> > <dashw...(a)removethis.enternet.co.nz> wrote:
> >> B-Riemke wrote:
> >>> Hi,
> >>> i have a problem with Excel 2007.
>
> >>> The OLE Fuction "setPrintArea" is working in all Excel Versions but
> >>> not in the Version 2007.
>
> >>> Have anyone test this Funkction under Excel 2007?
>
> >>> Best Regards
>
> >>> Bernd
>
> >> I have been using Excel 2007 without problem from Fujitsu NetCOBOL
> >> and C#.
>
> >> Can you tell us exactly how it fails? What is the COM return code?
> >> Sample code?
>
> >> I haven't used this particular function, but it obviously SHOULD
> >> work.
>
> >> Does it simply not print? Have you tried print preview? Do you have
> >> object references to Excel, the Workbook and the Worksheet all
> >> previously established?
>
> >> This SHOULD be a simple matter of telling SetPrintArea the range you
> >> want printed then printing it.
>
> >> Are you sure you are referencing the current worksheet? (If you
> >> saved it already it may need re-referencing.)
>
> >> Post your code if you want further help.
>
> >> Pete.
>
> >> --
> >> "I used to write COBOL...now I can do anything."
>
> > ********************************************************
> > *
> > * Macro from Excel 2007:
> > * ActiveSheet.PageSetup.PrintArea = "$A$1:$EA$267"
> > * This is working under all versions but not under 2007
> > *
> > ********************************************************
>
> > Move z"1:267" TO X-00-TEXT
>
> > INVOKE WorkBook "getActiveSheet" RETURNING ActiveSheet.
>
> > INVOKE ActiveSheet "getPageSetup" Returning PageSetup.
>
> > INVOKE PageSetup  "setPrintArea" using X-00-TEXT
>
> > ******************************************************
>
> That looks OK, but you haven't told us what the HResult is. That gives a
> clue as to why it isn't working.
>
> Try and forget that it works in other versions, that doesn't help the
> immediate problem, which you need to see as if it were new.
>
> It seems very likely to me that the problem is being caused by the value of
> X-00-TEXT.
>
> Have you tried setting a standard range in there like:  "$A$1:$EA$267" ?
>
> I'd try some experiments with this, like a value of "$A$1:$A$1" and see if
> it will print a single cell. This will at least establish whether the
> problem is in the print function or with the range specified for the
> worksheet.
>
> Pete.
>
> --
> "I used to write COBOL...now I can do anything."- Hide quoted text -
>
> - Show quoted text -

I have testet "$A$1:$EA$267" but I become

OLE Error 1 (OLE Server error)

Exeption Number 65537

I think that there is a Microsoft Excel 2007 Bug

If you search via Google for "excel 2007 set print area" you can see
that there are some problems with that function.

Best Regards

Bernd