embedded macros

embedded macros

Anonymous
Not applicable
893 Views
8 Replies
Message 1 of 9

embedded macros

Anonymous
Not applicable
hi

i was wondering if it was possible to extract an embedded macro via vba

thanks in advance

cheers
mark
0 Likes
894 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
As far as i know,its not possible. But if you save the macro in to module or
else you can import it .

"Mark Dubbelaar" wrote in message
news:3344C0BEEE568493D30B8EC584AB2431@in.WebX.maYIadrTaRb...
> hi
>
> i was wondering if it was possible to extract an embedded macro via vba
>
> thanks in advance
>
> cheers
> mark
>
>
0 Likes
Message 3 of 9

Ed__Jobe
Mentor
Mentor
Mark, It depends if you want to do it programmatically or not. If not, you can export/import modules as suggested before. Otherwise you can use the Application.VBE object to gain access to the vlide. Access a project via the VBProjects collection or the Application.ActiveProject property. Read/write code to the project's CodeModule.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 4 of 9

Anonymous
Not applicable
ed,

what i am trying to do, is automatically extract an
embedded macro (if it exists)... when i first start using VBA i had a template
with an embedded project in it (i thought this was the only to achieve what i
was after) but later i found that you could use the acad.dvb to load vba
files... and hence i have a whole lot of drawings with this file embedded, which
is no longer needed.... if there is a way to programmatically extract the
embedded routine that would be good, otherwise i'll have to bit the bullet and
manually extract it....

 

cheers

 mark


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Mark,
It depends if you want to do it programmatically or not. If not, you can
export/import modules as suggested before. Otherwise you can use the
Application.VBE object to gain access to the vlide. Access a project via the
VBProjects collection or the Application.ActiveProject property. Read/write
code to the project's CodeModule.
0 Likes
Message 5 of 9

Ed__Jobe
Mentor
Mentor
I havn't tried to do what you ask, but I've seen other code segments that read/write to code modules, so it should be possible. Use the object browser to get familiar with the objects I mentioned earlier.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 6 of 9

Ed__Jobe
Mentor
Mentor
After looking into it further, you won't be able to use the VBE object since the vbaide doesn't have the ability to extract/embed vba. The vbaman dialog is the only thing in acad that will do it and unfortunately it will not run as a command line version, so you can't script it either.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

0 Likes
Message 7 of 9

Anonymous
Not applicable
thanks for your help ed... i thought that might be
the case


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
After
looking into it further, you won't be able to use the VBE object since the
vbaide doesn't have the ability to extract/embed vba. The vbaman dialog is the
only thing in acad that will do it and unfortunately it will not run as a
command line version, so you can't script it either.
0 Likes
Message 8 of 9

Anonymous
Not applicable
Unless I am misunderstanding this thread and/or your problem, simply
use:

Sub RemoveProj ()
Dim objProj as VBProject
Dim objIDE As VBE
Set objIDE = Application.VBE
'---------------------------------
'Iterate thru the VBE looking for
'any currently loaded projects
'---------------------------------
For Each objProj in objIDE.VBProjects
If objProj.Name = "MY_APP" Then
objIDE.VBProjects.Remove objProj
End If
Next
End Sub


===============================
Mike Tuersley
PhD @ CADalyst's AutoCAD Clinic
http://www.cadonline.com
0 Likes
Message 9 of 9

Anonymous
Not applicable
You might be able to use CodeModule.DeleteLines to wipe out all the code.
This should work if macro is in ThisDrawing module. If it's in another
module, you should be able to delete the module.

"Mike Tuersley" wrote in message
news:MPG.17fd10c9ac695e80989688@discussion.autodesk.com...
> Unless I am misunderstanding this thread and/or your problem, simply
> use:
>
> Sub RemoveProj ()
> Dim objProj as VBProject
> Dim objIDE As VBE
> Set objIDE = Application.VBE
> '---------------------------------
> 'Iterate thru the VBE looking for
> 'any currently loaded projects
> '---------------------------------
> For Each objProj in objIDE.VBProjects
> If objProj.Name = "MY_APP" Then
> objIDE.VBProjects.Remove objProj
> End If
> Next
> End Sub
>
>
> ===============================
> Mike Tuersley
> PhD @ CADalyst's AutoCAD Clinic
> http://www.cadonline.com
0 Likes