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

|
0 Comments:
Post a Comment
<< Home