muck Posted April 16, 2012 Posted April 16, 2012 Using AutoCAD 12 (64bit), VB 2008 express ed. I am getting HResult 0x800700007E When I use this statement Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument I am linked to AutoCAD 2012. Any suggestions Quote
BlackBox Posted April 16, 2012 Posted April 16, 2012 Try changing this: Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.D ocumentManager.MdiActiveDocument ... To this: Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument ** I removed the space after the "D" in "D ocumentManager" Separately, if you use: Imports Autodesk.AutoCAD.ApplicationServices ... At the top of your class (before the namespace), then you can simply use this in your Sub/Function: Dim doc As Document = Application.DocumentManager.MdiActiveDocument HTH Quote
muck Posted April 16, 2012 Author Posted April 16, 2012 The space after the d is removed I have the code Dim doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument but I cut and Paste it in this post I see a space. Maybe there is a hidden character there? Any other suggestions? Thank you Quote
BlackBox Posted April 16, 2012 Posted April 16, 2012 You did it again... You state that there's no space, yet you post code WITH the space. Try this: Imports Autodesk.AutoCAD.ApplicationServices Imports Autodesk.AutoCAD.DatabaseServices Imports Autodesk.AutoCAD.EditorInput Imports Autodesk.AutoCAD.Runtime Imports System 'This line is not mandatory, but improves loading performance <Assembly: CommandClass(GetType(Foo.FooCLass))> Namespace Foo Public Class FooCLass <CommandMethod("FOO")> _ Public Sub FOO() Dim doc As Document = _ Application.DocumentManager.MdiActiveDocument If doc <> Nothing Then MsgBox("Yay!") Else MsgBox("Boo!") End If End Sub End Class End Namespace Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.