Saurabh.Gupta

Is there a limit on the nunber of worksheets one can include in a workbook, while using VSTO to generate the workbook itself. I need upto 40. Any unexpected\potential problem with this

Appreciate your time & thoughts.



Re: Visual Studio Tools for Office Is there a limit on the nunber of worksheets one can include in a workbook, while using VSTO?

Dennis Wallentin

Hi,

The number of worksheets that can be added in Excel is in general subject to the available RAM.

The following code in a VSTO workbook level solution didn't cause any issues when I ran it (2 GB RAM):

Private Sub ThisWorkbook_Startup(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Startup

Dim Counter As Integer = 0

For Counter = 1 To 1000

Me.Application.Worksheets.Add()

Next

End Sub

Of course, if You intend to add a great number of controls etc on each sheet as well then it can be some issues.






Re: Visual Studio Tools for Office Is there a limit on the nunber of worksheets one can include in a workbook, while using VSTO?

Saurabh.Gupta

Thanks, Appreciate your time.
Perhaps, too much data\controls on the worksheet bogs it down.