- 我想我给你贴的代码你没有看吧,我再贴一次好了,你在我指出的地方sendcommand加载你的lisp,请试一下,看行不行。
复制代码- Private Type BrowseInfo
- hWndOwner As Long
- pIDLRoot As Long
- pszDisplayName As Long
- lpszTitle As Long
- ulFlags As Long
- lpfnCallback As Long
- lParam As Long
- iImage As Long
- End TypePrivate Const BIF_RETURNONLYFSDIRS = 1
- Private Const MAX_PATH = 260
- 'Public Declare function GetVersion Lib "Kernel32" () As Integer
- Private Declare function GetCommandLine Lib "Kernel32" Alias "GetCommandLineA" () As String
- Private Declare Sub CoTaskMemFree Lib "ole32.dll" (ByVal hMem As Long)
- Private Declare function lstrcat Lib "Kernel32" Alias "lstrcatA" (ByVal lpString1 As String, ByVal lpString2 As String) As Long
- Private Declare function SHBrowseForFolder Lib "shell32" (lpbi As BrowseInfo) As Long
- Private Declare function SHGetPathFromIDList Lib "shell32" (ByVal pidList As Long, ByVal lpBuffer As String) As LongPublic Sub qdtubl()
- Dim inDir As String
- Dim elem
- Dim filenom As String
- Dim WholeFile As String
- Dim newHeight As Double
- Dim tufu As String
- Dim neirong33 As String
- inDir = ""
- inDir = ThisDrawing.BrowseForFolder("请选择目录:")
- If inDir = "" Then Exit Sub
- If Right(inDir, 1) = "" Then inDir = Left(inDir, Len(inDir) - 1)
- filenom = Dir$(inDir & "\*.dwg")
- 'On Error GoTo errorcontrol
- Do While filenom <> ""
-
- WholeFile = inDir & "" & filenom
- ThisDrawing.Application.Documents.Open WholeFile在这里加入你的sendcommand代码
- ThisDrawing.Application.ActiveDocument.Close filenom = Dir$
- Loop
- Exit Suberrorcontrol:
- MsgBox "错误,程序退出!"
- End SubPublic function BrowseForFolder(sPrompt As String) As String
- 'Public function BrowseForFolder(hWndOwner As Long, sPrompt As String) As StringDim iNull As Integer
- Dim lpIDList As Long
- Dim lResult As Long
- Dim sPath As String
- Dim udtBI As BrowseInfo
- With udtBI
- ' .hWndOwner = hWndOwner
- .lpszTitle = lstrcat(sPrompt, "")
- .ulFlags = BIF_RETURNONLYFSDIRS
- End With lpIDList = SHBrowseForFolder(udtBI) If lpIDList Then
- sPath = String$(MAX_PATH, 0)
- lResult = SHGetPathFromIDList(lpIDList, sPath)
- Call CoTaskMemFree(lpIDList)
- iNull = InStr(sPath, vbNullChar) If iNull Then
- sPath = Left$(sPath, iNull - 1)
- End If End If BrowseForFolder = sPath
- End Function
|