vba转换vb.net6 vba转vbs

vba代码转换成vb代码由于不清楚这段VBA代码的具体含义,所以只是大概转换了一下,不知道能否运行 。
'在VB中运行前需勾选"工程"-"引用"-"Microsoft Word 11.0 Object Library"
Dim wdApp As Word.Application
Dim wdDoc As Word.Document
Set wdApp = New Word.Application
Set wdDoc = wdApp.Documents.Add
wdApp.ChangeFileOpenDirectory "E:\毕设1\"
wdApp.Selection.InsertFile FileName:="1.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.InsertFile FileName:="2.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.InsertFile FileName:="3.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.InsertFile FileName:="4.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.InsertFile FileName:="5.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.InsertFile FileName:="6.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.InsertFile FileName:="7.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.InsertFile FileName:="8.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.InsertFile FileName:="9.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.InsertFile FileName:="10.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.InsertFile FileName:="11.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.InsertFile FileName:="12.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.InsertFile FileName:="13.doc", Range:="", ConfirmConversions:= _
False, Link:=False, Attachment:=False
wdApp.Selection.MoveUp Unit:=wdLine, Count:=191
wdDoc.TablesOfContents.Add Range:=Selection.Range, RightAlignPageNumbers:= _
True, UseHeadingStyles:=True, UpperHeadingLevel:=1, _
LowerHeadingLevel:=3, IncludePageNumbers:=True, AddedStyles:="", _
UseHyperlinks:=True, HidePageNumbersInWeb:=True, UseOutlineLevels:= _
True
wdDoc.TablesOfContents(1).TabLeader = wdTabLeaderDots
wdDoc.TablesOfContents.Format = wdIndexIndent
wdApp.ChangeFileOpenDirectory "C:\Users\Administrator\Desktop\"
wdApp.ActiveDocument.SaveAs FileName:="一1.doc", FileFormat:=wdFormatDocument, _
LockComments:=False, Password:="", AddToRecentFiles:=True, WritePassword _
:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _
SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
False
wdApp.ActiveWindow.Close
您好请问如何将vba改成vb.net呢?谢谢啦) Dim swApp As Object Dim Part As Object Dim boolstatus As BooswApp.ActiveDoc是什么东西?word的吗?
如果是ord的东西 , 那么将set去掉就可以了,其他的不需要做任何更改 。
VBA代码转换VB代码'首先要将“工程-引用”中vba转换vb.net6的Mic… Excel…选中
'Set xlBook = xlApp.Workbooks.Open("文件名") '打开已经存在vba转换vb.net6的EXCEL工件簿文件
'xlApp.Visible = True '设置EXCEL对象可见(或不可见)
'Set xlSheet = xlBook.Worksheets("表名") '设置活动工作表
'Range("K12").Select 设置活动单元格
'xlSheet.Cells(Row, col) = 值 '给单元格(row,col)赋值
'xlSheet.PrintOut '打印工作表
'xlBook.Close (True) '关闭工作簿
'xlApp.Quit '结束EXCEL对象
'Set xlApp = Nothing '释放xlApp对象.
'xlBook.RunAutoMacros (xlAutoOpen) '运行EXCEL启动宏
'xlBook.RunAutoMacros (xlAutoClose) '运行EXCEL关闭宏

推荐阅读