Com Object and AutoCAD Electrical

Com Object and AutoCAD Electrical

Anonymous
Not applicable
359 Views
2 Replies
Message 1 of 3

Com Object and AutoCAD Electrical

Anonymous
Not applicable
Hi,

Does anyone knows how a "vertical" can be loaded.
It's no problem to launch "Vanilla" Acad, but I also need the Eelctrical functionality.

The problem is that none of the AutoCAD Electrical functionality is loaded.

It gives the following message in the prompt.

AutoCAD Electrical menu utilities ; error: no function definition:
WD_ARX_FORMAT_PATH

This is occuring when I use the following code in Excel:

Option Explicit

Private Sub OpenAutoCAD(AutoCAD As AcadApplication)
On Error Resume Next
'attempt to open running AutoCAD
Set AutoCAD = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
'AutoCAD not running, attempt to start
Set AutoCAD = CreateObject("AutoCAD.Application")
If Err Then
'AutoCAD cannot be started, exit
MsgBox "Error, AutoCAD cannot be executed", vbCritical, "Error loading AutoCAD"
On Error GoTo 0
Exit Sub
End If
End If
'make running AutoCAD visible
AutoCAD.Visible = True
End Sub

Public Sub Main()
Dim oAcad As AcadApplication
'open AutoCAD first
OpenAutoCAD oAcad
'then create my stuff
End Sub

If I start AutoCAD Electrical with the icon it works ok, but as soon if I automate it goes wrong. Although it looks the correct profile is loaded.
Does anyone has an idea to get it running?
0 Likes
360 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
You code simply start a "Vanilla" Acad instance, which does not know
anything about Electrical at all, of course.
I does not know how Electrical is loaded into Acad. If it is loaded through
a specific profile (very likely), then after acad started, you simply use
AcadPreferencesProfiles object to load required profile (

You can find the profile name by right-click the
shortcut->properties->Target text box.

It should read like this:

[Acad installation path]\Acad [Electrical\acad.exe /p [profileName]




wrote in message news:5749491@discussion.autodesk.com...
Hi,

Does anyone knows how a "vertical" can be loaded.
It's no problem to launch "Vanilla" Acad, but I also need the Eelctrical
functionality.

The problem is that none of the AutoCAD Electrical functionality is loaded.

It gives the following message in the prompt.

AutoCAD Electrical menu utilities ; error: no function definition:
WD_ARX_FORMAT_PATH

This is occuring when I use the following code in Excel:

Option Explicit

Private Sub OpenAutoCAD(AutoCAD As AcadApplication)
On Error Resume Next
'attempt to open running AutoCAD
Set AutoCAD = GetObject(, "AutoCAD.Application")
If Err Then
Err.Clear
'AutoCAD not running, attempt to start
Set AutoCAD = CreateObject("AutoCAD.Application")
If Err Then
'AutoCAD cannot be started, exit
MsgBox "Error, AutoCAD cannot be executed", vbCritical, "Error loading
AutoCAD"
On Error GoTo 0
Exit Sub
End If
End If
'make running AutoCAD visible
AutoCAD.Visible = True
End Sub

Public Sub Main()
Dim oAcad As AcadApplication
'open AutoCAD first
OpenAutoCAD oAcad
'then create my stuff
End Sub

If I start AutoCAD Electrical with the icon it works ok, but as soon if I
automate it goes wrong. Although it looks the correct profile is loaded.
Does anyone has an idea to get it running?
0 Likes
Message 3 of 3

Anonymous
Not applicable
Hi Norman Yuan,

Thanks for your answer, the problem is not to load the profile, I tried that also but I'm still getting this error message with AutoCAD Electrical 2008:

AutoCAD Electrical menu utilities ; error: no function definition:
WD_ARX_FORMAT_PATH

If I use the same code but then first startup and close Acad E 2007, it runs fine for the Electrical 2007 version.

So my guess is that Autodesk has changed something in his code.
0 Likes