Home  |  Index  |  Dotnet4all Snippets  |  Submit resources
About  |  Mail us  
Dotnet4all Logo
Excel and vb.net (Thursday, December 16, 2004)
 

Found the following interesting discussion in the Newsgroups:

Excel and vb.net
by:MadIndian

I am using this code to change the page orientation in excel, previously
worked fine now it takes 20 seconds to execute any ideas are greatly
appreciated

Code:
Dim objExcel As New Excel.Application

Dim objBook As Excel.Workbook = objExcel.Workbooks.Add

Dim objSheet As Excel.Worksheet = CType(objBook.Worksheets(1),
Excel.Worksheet)

objSheet.PageSetup.Orientation = Excel.XlPageOrientation.xlLandscape ' Hangs
here and never used to then continues on

Keith


 Reply:
by:mwazir

 I have used Excel in my application and I found that Excel used to take a
lot longer to finish if its visible property was True. I dont know if it is
applicable to your scenario but try it out

objExcel.Visible = False ' After creating the Excel instance
objExcel.Visible = True ' At the end of your excel operation.
In many cases you wouldnt even need to set it back to True because you want
Excel to do some operations behind the scene for you.

HTH

--
Wazir



Posted by Xander Zelders



 
Previous Posts
    - DataGrid Issues
    - format listbox
    - Memory Usage and Page File Usage - Help!
    - Image ComboBox-How to use them?
    - Scroll Bar
    - bizarre Async socket client behavior
    - Blank Page Printed
    - How do I pass aninstantiated class from webform to...
    - Change the 'Extend my windows desktop...' property...
    - Sub query using parameters with OleDb Data adapter...

Archives
    - 10/03/2004 - 10/10/2004
    - 10/10/2004 - 10/17/2004
    - 10/17/2004 - 10/24/2004
    - 10/24/2004 - 10/31/2004
    - 10/31/2004 - 11/07/2004
    - 11/21/2004 - 11/28/2004
    - 11/28/2004 - 12/05/2004
    - 12/05/2004 - 12/12/2004
    - 12/12/2004 - 12/19/2004
    - 12/19/2004 - 12/26/2004
    - 12/26/2004 - 01/02/2005
    - 01/23/2005 - 01/30/2005
    - 01/01/2006 - 01/08/2006
    - 09/24/2006 - 10/01/2006


Disclaimer & Terms of Use  | DotNet4All.Com concept & © 2004 - 2007 by  Zelders²  - Holland