|
-
Jan 16th, 2003, 03:05 PM
#1
Thread Starter
Junior Member
Using Excel in VB .NET
Well most of the excel code for excel 9.0 object library works in .NET correctly.....but I have one question.
When I create a excel application object, how do I get VB . NET to change the orientation of the worksheet to landscape instead of portrait?
I used the following code in VB 6.0 but it doesn't work in .NET.
oExcelApp.ActiveSheet.PageSetup.Orientation = xlPortrait
It doesn't recognize the xlportrait part of the equation.
Any help would be appreciated.
-
Jan 16th, 2003, 03:28 PM
#2
Member
Hi
I had a similar problem. You can use the Enum values to get around it for now . Just replace the constants with their values in your code. The values can be found in the Object Browser.
oExcelApp.ActiveSheet.PageSetup.Orientation = 1
xlPortait = 1
xlLandscape = 2
If you find a better solution please post it.
Harold Hoffman
-
Jan 16th, 2003, 03:45 PM
#3
Thread Starter
Junior Member
Thanks for the help....there is another way also
oWs = oExcelApp.ActiveSheet
oWs.PageSetup.Orientation = Excel.XlPageOrientation.xlPortrait
This will work as well
-
Jan 16th, 2003, 04:05 PM
#4
Member
Hi
Your way is better and works fine. Little difficult though to find the right object model.
Thanks.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|