M
MichaelZhu
Unregistered / Unconfirmed
GUEST, unregistred user!
各位请教个问题,怎么才能将以下的VBA代码转换为DELPHI代码?
或者是有没有别的办法,在DELPHI中检测有没有指定的WORD文件打开?
Public Function checkDocFileOpenAndClose(ByVal strDocFileName As String)
On Error Resume Next
Dim docAPP As Object
Dim doc As Object
Set docAPP = GetObject(, "Word.Application")
If Err.Number <> 0 Then Exit Function
For Each doc In docAPP.documents
'If InStr(1, doc.Name, strdocFileName, 1) Then
If doc.Name = strDocFileName Then
doc.Close '关闭文档
' MyXL.Quit '退出excel
Exit For
End If
Next doc
Set doc = Nothing
Set docAPP = Nothing
或者是有没有别的办法,在DELPHI中检测有没有指定的WORD文件打开?
Public Function checkDocFileOpenAndClose(ByVal strDocFileName As String)
On Error Resume Next
Dim docAPP As Object
Dim doc As Object
Set docAPP = GetObject(, "Word.Application")
If Err.Number <> 0 Then Exit Function
For Each doc In docAPP.documents
'If InStr(1, doc.Name, strdocFileName, 1) Then
If doc.Name = strDocFileName Then
doc.Close '关闭文档
' MyXL.Quit '退出excel
Exit For
End If
Next doc
Set doc = Nothing
Set docAPP = Nothing