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