By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,963 Members | 1,841 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,963 IT Pros & Developers. It's quick & easy.

Excel and vb.net

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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


"MadIndian" <Ma********@Hotmail.com> wrote in message
news:Of*************@TK2MSFTNGP10.phx.gbl...
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

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.