Vb.Net MS Publisher将数组字符串转换为TextBox问题

时间:2011-05-14 12:20:37

标签: vb.net vba textbox ms-office publisher

我正在创建一个Simple Publisher应用程序,我需要在一个字符串数组中的不同文本框中插入文本。我已经像这样编码了。

    Dim texts(40) As String 'Array of strings to be inserted 

    shpTextBox = appPub.ActiveDocument.Pages(pageIndex).Shapes.AddTextbox _
          (Orientation:=PbTextOrientation.pbTextOrientationHorizontal, _
          Left:=pbShape.Left - 20, Top:=pbShape.Top, _
          Width:=72, Height:=18)


                'add text 
                shpTextBox.TextFrame.TextRange.Text = texts(Index)'Problem here , Only First array value is populating to very first text box , rest are empty strings.

                Index = Index + 1 

现在它只使用数组中的第一个字符串填充第一个文本框(对于第0个索引),其余文本框包含空字符串,尽管文本数组具有值。

任何帮助都将受到高度赞赏。

感谢。

1 个答案:

答案 0 :(得分:0)

将代码更改为C#,现在工作正常...... !!