想把word打開的宏封裝成dll,但是不知道vb怎么寫,總是提示錯誤,求大神幫忙
Private Sub Document_Open()
Dim t As Date, bookMarkName As String, bkMark As Range
filename = Application.ActiveDocument.FullName
Key = "C:\Users\Administrator\Desktop\現病人.exe\令牌.key"
Documents.Open filename:=Key, passworddocument:="123"
Documents(Key).Activate
t = Format(ActiveDocument.Bookmarks("授權日期").Range, "YYYY-MM-DD")
Selection.GoTo What:=wdGoToBookmark, name:="定制團隊"
Selection.Copy
Documents(Key).Close
Documents(filename).Activate
Selection.GoTo What:=wdGoToBookmark, name:="定制團隊"
Selection.PasteAndFormat (wdPasteDefault) bookMarkName = "期限" Set bkMark = ActiveDocument.Bookmarks(bookMarkName).Range bkMark.Select bkMark.Text = t ActiveDocument.Bookmarks.Add bookMarkName, bkMark If Date < t And FileFolderExists("E:\Diego Costa\repair.set") Then
登錄選單.Show
ActiveDocument.Protect wdNoProtection
ActiveDocument.Fields.Locked = False
Else
MsgBox "授權已過期或組態檔錯誤!!!"
ActiveDocument.Close savechanges:=False
End If
End Sub


轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/10418.html
標籤:VBA
下一篇:Private Sub Button1_Click(sender As Object, e As System.EventArgs)具有多個帶有相同簽名的定義
