使用vb.net应用程序运行宏以格式化Word文档

时间:2019-05-02 08:28:33

标签: vb.net

我有一个扩展名为.DO Files(.DO)的宏文件。我通过vb.net

打开文件

应用程序,并同时打开一个宏。通过使用该宏,我需要格式化该Word文档。我

尝试了很多,但没有用。我尝试选择Word文件的某些区域,但这会导致错误:

  

对象引用未设置为对象实例

Private sub beginFormatting
    ls_inipath = System.Windows.Forms.Application.StartupPath & "\"
    ls_Document = GetIniValue("Remove_Pages", "doc_name", txtFileName.Text)

    Dim what As Object = Word.WdGoToItem.wdGoToLine
    Dim which As Object = Word.WdGoToDirection.wdGoToLast

    Dim SelectionOne As Selection

    Dim returnValue As Range = SelectionOne.GoTo(what, which, Nothing, 
   Nothing)

    SelectionOne.EndKey(WdUnits.wdStory, WdMovementType.wdMove)
end sub

0 个答案:

没有答案