Want to change the Excelsheet Grid Size in my own MSExcel plugin programatically in VS.NET RRS feed

  • Question

  • Hey,

    I want to change the EXCELSHEET grid size in the excel plugin programatically developed in VS.NET..

    As well i am trying to change the Design Area width and height programatically

    How can i do this?

    Thursday, December 8, 2011 11:41 AM

All replies

  • you can do this with cell width and row height properties.
    Saturday, December 10, 2011 3:15 PM
  • Hi Sreenivas,

    This is a general idea.....let me again explain you what i want is...

    i will set the cell  height and width for my active sheet.

    So i have written a rough code for that:


    Dim act As



    act = Globals.ThisAddIn.Application.ActiveSheet


    act.Cells.Width = 10

    but it gives the Compilation error..

    as Width and Height will be set into points.

    but i want to set the width in pixels.. As 5px

    please help me..

    Tuesday, December 13, 2011 5:47 AM
  •  something like this should work
     objSheet = objWorkbook.Sheets(1)
     objSheet.Cells.RowHeight = 8.43
     objSheet.Cells.ColumnWidth = 8.43

    Tuesday, December 13, 2011 6:31 AM
  • Thnx Mike for your useful Posts.

    But it is setting the height and width in points ..

    How can i set them in Pixels also.

    Could you please give me some idea also for that is it possibe to adjust the complete Canvas ARea .

    Suppose i want to have the ActiveSheet Canvas Area Height and Width( NOT CELL WIDTH AND HEIGHT) according to the slected Platfom for designing.

    Ok LET ME clear you the requirement according to the IMGAE THAT I AM ATTACHING HERE.

    Now if you are able to see the image you will be seeing that the requirement is to SELECT THE TEMPLATE THAT MEANS FOR WHICH PLATFORM I AM DESIGNING THE WIREFRAME(DESIGN PROTOTYPE) and then i will select the Grid Size in PIXELS and then finally i will select the WIDTH AND HEIGHT FOR ACTIVE SHEET CANVAS AREA.



    Tuesday, December 13, 2011 8:04 AM
    Wednesday, December 14, 2011 7:13 AM
  • act.Cells.RowHeight = CType(txtGrid.Text, Integer)

    This line is raising an error,..


    Monday, December 19, 2011 7:03 AM
  • I hope this helps


        Private Sub Sheet1_Startup() Handles Me.Startup
            Dim str As String
            str = "100"
            Me.Cells.ColumnWidth = Double.Parse(str) / (Me.Range("a1").Width / Me.Range("a1").ColumnWidth)
            Me.Cells.RowHeight = 100
        End Sub

    Wednesday, January 11, 2012 2:32 AM