Excel and vb.net

M

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
 
M

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top