-1

I am using worksheet object to write data to excel sheet.Creaating columns and writing my data from datatable to sheet.this is showing the data writing process on screen and then generating Pivot table.I dont want to display the writing process.Plz help me to hide that process.

2 Answers2

1

I'm sure whether you are talking about Microsoft.Office.Interop.Excel.Application (but "worksheet object" suggests that), then it would be:

Microsoft.Office.Interop.Excel.Application excelApp = null;
excelApp = new Microsoft.Office.Interop.Excel.Application();
excelApp.Visible = false;
Michał Powaga
  • 22,561
  • 8
  • 51
  • 62
  • By making iy visible=false,still it showing the writing process – user1037113 Nov 09 '11 at 08:01
  • @user1037113 "writing process" - do you mean Excel process in Task Manager? If yes, then while Excel is working (i think) there is no way to hide it. After it stopped writing to worksheet you can close it there is info how http://stackoverflow.com/questions/158706/how-to-properly-clean-up-excel-interop-objects-in-c-sharp – Michał Powaga Nov 09 '11 at 08:13
0

You can use Application.ScreenUpdating = false, but this stops all screen updates. If the window is dragged during this time, a ghost image will be left behind. You must be very careful with this -- you have to set it back to true.

A better option would be to activate a worksheet other than the one(s) being updated. You can show Sheet 1, for example, while updating Sheet 2, Sheet 3, and so on.

Jay
  • 56,361
  • 10
  • 99
  • 123