Dim docs As DocumentCollection = Application.DocumentManager
Dim MyDir = "C:\新建文件夹"
Dim MyFilter = "*.dwg"
For Each MyFile In System.IO.Directory.GetFiles(MyDir, MyFilter)
Dim filename As String = MyFile
Dim doc As Document = docs.Open(filename, True)
'设置当前的活动文档为新打开的Dwg文件()
docs.MdiActiveDocument = doc'运行到这里就停了不能运行下面的语句请指教
Public Sub OpenDwg()
Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor
'获取文档管理器对象以打开Dwg文件
Dim docs As DocumentCollection = Application.DocumentManager
Dim filename As String
filename = My.Application.Info.DirectoryPath & "\tsf.dwg"
'打开所选择的Dwg文件
Dim doc As Document = docs.Open(filename, True)
'设置当前的活动文档为新打开的Dwg文件
Application.DocumentManager.MdiActiveDocument = doc
End Sub
我在form中调用opendwg()时提示执行环境效,(已经导入相同的COM了),但是执行命令:opendwg又可以打开文件,这个是什么原因呢,又如何解决呢?