How do you place a textbox object over a specific Cell when automating Excel?

后端 未结 2 971
囚心锁ツ
囚心锁ツ 2021-01-13 16:09

We are automating Excel using VB.Net, and trying to place multiple lines of text on an Excel worksheet that we can set to not print. Between these we would have printable re

2条回答
  •  孤独总比滥情好
    2021-01-13 16:23

    If you have the cell name or position, you can do:

    With ActiveSheet
      .Shapes.AddTextbox msoTextOrientationHorizontal, .Cells(3,2).Left, .Cells(3,2).Top, .Cells(3,2).Width, .Cells(3,2).Height
    End With
    

    This will add a textbox over cell B3. When B3 is resized, the textbox is also.

提交回复
热议问题