Home > Software engineering >  Please god help vba to vb
Please god help vba to vb

Time:11-07

Want to open the word macro encapsulated into a DLL, but don't know how to write the vb, always prompt error, a great god help
Private Sub Document_Open ()
Dim t As the Date, bookMarkName As String, bkMark As Range
Filename=Application. The ActiveDocument. FullName
Key="C: \ Users/Administrator/Desktop/patient now. Exe \ token. Key"
The Documents. The Open filename:=Key, passworddocument:="123"
The Documents (Key). Activate

T=Format (ActiveDocument Bookmarks (" authorized date "). The Range of "YYYY - MM - DD")

Selection. GoTo I:=wdGoToBookmark, name:="custom team"
Selection. Copy
The Documents (Key). Close
The Documents (filename). Activate
Selection. GoTo I:=wdGoToBookmark, name:="custom team"
Selection. PasteAndFormat (wdPasteDefault) bookMarkName="time" is Set bkMark=ActiveDocument. Bookmarks (bookMarkName). The Range bkMark. Select bkMark. Text=t ActiveDocument. Bookmarks. Add bookMarkName, bkMark If Date & lt; T And FileFolderExists (" E: \ Diego Costa \ repair set ") Then
The login menu. The Show
ActiveDocument. Protect wdNoProtection
ActiveDocument. Fields. Locked=False
The Else
MsgBox "authorization has expired or the configuration file error!!! "
ActiveDocument. Close savechanges:=False
End the If

End Sub
  •  Tags:  
  • VBA
  • Related