Home > Net >  VBA code to vb.net
VBA code to vb.net

Time:09-22

Everybody the teacher good!
A VBA code below the current page Word document can be split into multiple small documents, and how to convert vb.net code, give advice or comments please,
Thank you very much!

Sub BreakOnPage () 'subroutine BreakOnPage ()
Application. The Target Application of Browser Target==wdBrowsePage 'wdBrowsePage
For I=1 To ActiveDocument. BuiltInDocumentProperties (" the Number of Pages ") 'set the variable range For I=1 To ActiveDocument BuiltInDocumentProperties (" the Number of Pages ")
ActiveDocument. Bookmarks (\ "page") Range. Copy 'ActiveDocument of Bookmarks (\ "page") area of the cell replication
The Documents. Add 'Documents to Add
Selection. The option to Paste Paste '
Selection. TypeBackspace TypeBackspace 'is options
ChangeFileOpenDirectory "C: \ 'ChangeFileOpenDirectory" "C: \
"DocNum=DocNum DocNum=DocNum + 1 + 1 '
ActiveDocument. SaveAs FileName:="test_" & amp; DocNum & amp; "Doc" 'ActiveDocument SaveAs filename="test_" & amp; DocNum & amp; "Doc"
The closing of the ActiveDocument. Close 'ActiveDocument
Application. The Next 'Application of Browser under a
Next I Next I
ActiveDocument. Close savechanges: the closing of the ActiveDocument savechanges==wdDoNotSaveChanges' wdDoNotSaveChanges
End Sub 'End of the subroutine

CodePudding user response:

You what a large span, the.net implementation VBA, want to use VSTO or third-party Office library rewritten, not directly conversion,

CodePudding user response:

This is one of the code, you want to rewrite more troublesome,
Recommendations will be written by VBA function on VB6 are encapsulated into a DLL, and then in the.net inside calls,

CodePudding user response:

Vba code is usually in the office have drills, vb.net does not need to convert the code, need to refer to office type library, and indirectly invoked
  • Related