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关闭宏
推荐阅读
- 钓鱼发烧友修改器安卓,钓鱼发烧友破解版内购怎么弄?
- word如何查看英文单词,word如何查看英文单词内容
- 平板微信收不到直播链接,平板微信收不到直播链接怎么办
- 创建系统组linux命令 linux新建系统组的命令
- 开发小程序怎么不花钱下载,开发小程序怎么不花钱下载软件
- 做电商如何找厂家,做电商如何找厂家合作
- 陌陌角色扮演手游游戏推荐,陌陌 游戏
- linux下连续执行命令 linux执行多条命令
- 抖音带货直播新号设置什么,抖音带货教程详细步骤