I have a program in vb.net to create and automate a Word document. I am adding a command button to the document, and giving it parameters: '************ CommandButton 1 Dim shp As Word.InlineShape Dim sPrinter As String = z.Printer Dim wdShapeRight As String = "" Dim wdRelativeHorizontalPositionMargin As String = "" shp = oMainDoc.Content.InlineShapes.AddOLEControl(ClassType:="Forms.CommandButton.1") shp.OLEFormat.Object.AutoSize = False shp.OLEFormat.Object.WordWrap = True shp.OLEFormat.Object.Caption = sPrinter Shp.OLEFormat.Object.ToString Dim tShp As word.Shape Dim tTest As Integer =0 tShp = shp.ConvertToShape() tShp.OLEFormat.Object.Name = "ATPbutton1" tshp.OLEFormat.Object.wordwrap = True tshp.OLEFormat.Object.Caption = sPrinter tShp.OLEFormat.Object.Font.Name = "Times New Roman" tShp.OLEFormat.Object.Font.Size = 10 tShp.OLEFormat.Object.BackColor = WdColor.wdColorPaleBlue tShp.OLEFormat.Object.AutoSize = False Dim dWidth As Integer = oMainDoc.ActiveWindow.Document.PageSetup.PageWidth Dim dRMargin As Integer = oMainDoc.ActiveWindow.Document.PageSetup.RightMargin tShp.OLEFormat.Object.Width = len(sPrinter)+100 Dim cWidth As Integer = tshp.OLEFormat.Object.Width Dim cLeft As Integer = dWidth - dRMargin - cWidth tShp.OLEFormat.Object.Left = cLeft tShp.OLEFormat.Object.Top = 80 tShp.OLEFormat.Object.Height = 30 tShp.OLEFormat.Object.ToString
Dim shp As Word.InlineShape
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)