vba转vb.net vba转vbnet autocad
您好请问如何将vba改成vb.net呢?谢谢啦) Dim swApp As Object Dim Part As Object Dim boolstatus As Boo
swApp.ActiveDoc是什么东西?word的吗?
创新互联是一家从事企业网站建设、网站制作、网站设计、行业门户网站建设、网页设计制作的专业网站建设公司,拥有经验丰富的网站建设工程师和网页设计人员,具备各种规模与类型网站建设的实力,在网站建设领域树立了自己独特的设计风格。自公司成立以来曾独立设计制作的站点上千多家。
如果是ord的东西,那么将set去掉就可以了,其他的不需要做任何更改。
VBA代码转换VB代码
'首先要将“工程-引用”中的Mic… Excel…选中
'Set xlBook = xlApp.Workbooks.Open("文件名") '打开已经存在的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关闭宏
'xlBook.Worksheets.Count '工作簿标签总数
Private Sub Command1_Click()
Dim xlApp As Excel.Application
Set xlApp = New Excel.Application
Set xlApp = CreateObject("Excel.Application") '创建EXCEL对象
On Error Resume Next
Workbooks.Add '新建工作簿
MkDir "C:\123"
ChDir "C:\123" '在桌面上建“123”文件夹
'以下是将文件保存到“C:\\模板.xls”
ActiveWorkbook.SaveAs FileName:= _
"C:\123\模板.xls", FileFormat:=xlNormal, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
'Windows("模板.xls").Activate
xlApp.Visible = True
'Sheets("Sheet1").Select
Sheets.Add '新建工作表
Sheets("Sheet2").Name = "新建工作表"
'Sheets("Sheet3").Name = "Sheet"
ActiveWorkbook.Sheets("新建工作表").Tab.ColorIndex = 7 '给工作表标签指定颜色
xlApp.Worksheets("新建工作表").Range("A1").Cells(3, 2) = "添加数据"
'xlApp.Worksheets(Sheets(i).Name).Range("A1").Cells(j, 2) = "@"
'ActiveWorkbook.Sheets("考评").Tab.ColorIndex = 7
'ActiveWorkbook.Sheets("教师任课").Tab.ColorIndex = 7
'ActiveWorkbook.Sheets("班级设置").Tab.ColorIndex = 7
'ActiveWorkbook.Sheets("Zxmd").Tab.ColorIndex = 32
xlBook.Save
xlApp.Save
ActiveWorkbook.Close
xlBook.Close (True) '关闭工作簿
xlApp.Quit '结束EXCEL对象.
Set xlApp = Nothing '释放xlApp对象
End Sub
还可以到我博客中参阅其他有关代码
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 vba转vbnet autocad
URL标题:http://pwwzsj.com/article/doeohij.html