Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Delete a VBA macro from an add-in

10 REPLIES 10
Reply
Message 1 of 11
Anonymous
342 Views, 10 Replies

Delete a VBA macro from an add-in

I haven't even started looking at this yet but thought someone might know
off the top of their head.

Any way to delete the VBA code from a part via an add-in. I was thinking of
ways to overcome the problem of having too much code in the part files in a
large assembly. This way you could run the code on creation but when you
save the VB add-in deletes the code form the part.

Thinking out loud mainly... any comments?

--
Sean Dotson, PE
http://www.sdotson.com
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
-----------------------------------------------------------------------
10 REPLIES 10
Message 2 of 11
Anonymous
in reply to: Anonymous

Sean

I think it could be done using VBE. Wonder if it wouldn't be easier or better to have a
addin that did what you wanted to the files on creation?

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Sean Dotson" wrote in message
news:6F8E2F3CF30786CADE740C1147A72716@in.WebX.maYIadrTaRb...
> I haven't even started looking at this yet but thought someone might know
> off the top of their head.
>
> Any way to delete the VBA code from a part via an add-in. I was thinking of
> ways to overcome the problem of having too much code in the part files in a
> large assembly. This way you could run the code on creation but when you
> save the VB add-in deletes the code form the part.
>
> Thinking out loud mainly... any comments?
>
> --
> Sean Dotson, PE
> http://www.sdotson.com
> Check the Inventor FAQ for most common questions
> www.sdotson.com/faq.html
> -----------------------------------------------------------------------
>
>
Message 3 of 11
Anonymous
in reply to: Anonymous

That could be the case but I'd require several add-ins. The code is some
simple stuff that runs when you create the part. However it's different for
each part. So I'd like to run the part code then get rid of it.

So are you saying use SendKeys to the VBE to get rid of the code?

--
Sean Dotson, PE
http://www.sdotson.com
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
-----------------------------------------------------------------------
"Kent Keller" wrote in message
news:4E1DDE797919503AC3F5B9E6C45951AC@in.WebX.maYIadrTaRb...
> Sean
>
> I think it could be done using VBE. Wonder if it wouldn't be easier or
better to have a
> addin that did what you wanted to the files on creation?
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
>
>
> "Sean Dotson" wrote in message
> news:6F8E2F3CF30786CADE740C1147A72716@in.WebX.maYIadrTaRb...
> > I haven't even started looking at this yet but thought someone might
know
> > off the top of their head.
> >
> > Any way to delete the VBA code from a part via an add-in. I was
thinking of
> > ways to overcome the problem of having too much code in the part files
in a
> > large assembly. This way you could run the code on creation but when
you
> > save the VB add-in deletes the code form the part.
> >
> > Thinking out loud mainly... any comments?
> >
> > --
> > Sean Dotson, PE
> > http://www.sdotson.com
> > Check the Inventor FAQ for most common questions
> > www.sdotson.com/faq.html
> > -----------------------------------------------------------------------
> >
> >
>
>
Message 4 of 11
Anonymous
in reply to: Anonymous

No, not SendKeys. I think if you look in the VBA help (not Inventor) there is some info
on VBE. I seem to remember a example somewhere in there where it would add code to a
module so it stands to reason you could also remove code.

If you can't find it give me a buzz and I will take a look when I get a chance.

--
Kent
Assistant Moderator
Autodesk Discussion Forum Moderator Program


"Sean Dotson" wrote in message >
> So are you saying use SendKeys to the VBE to get rid of the code?
>
> --
> Sean Dotson, PE
> http://www.sdotson.com
> Check the Inventor FAQ for most common questions
> www.sdotson.com/faq.html
Message 5 of 11
Anonymous
in reply to: Anonymous

Ah gotcha. I was misunderstanding your suggestion. Thanks Kent.

--
Sean Dotson, PE
http://www.sdotson.com
Check the Inventor FAQ for most common questions
www.sdotson.com/faq.html
-----------------------------------------------------------------------
"Kent Keller" wrote in message
news:63CEF093C5FA3F56FBD510666D3CB190@in.WebX.maYIadrTaRb...
> No, not SendKeys. I think if you look in the VBA help (not Inventor)
there is some info
> on VBE. I seem to remember a example somewhere in there where it would
add code to a
> module so it stands to reason you could also remove code.
>
> If you can't find it give me a buzz and I will take a look when I get a
chance.
>
> --
> Kent
> Assistant Moderator
> Autodesk Discussion Forum Moderator Program
>
>
> "Sean Dotson" wrote in message >
> > So are you saying use SendKeys to the VBE to get rid of the code?
> >
> > --
> > Sean Dotson, PE
> > http://www.sdotson.com
> > Check the Inventor FAQ for most common questions
> > www.sdotson.com/faq.html
>
>
Message 6 of 11
avbuiten
in reply to: Anonymous

You want probably something like the code below.
Use the Local WIndows to explore the posibilities.
I don't think you can delete or unload entire files.

'you need a reference (VBA: Tools>Reference, VB>Project>Reference) to:
' Microsoft Visual Basic for Applications Extensibility 5.3
Sub Main()
Dim app As Application
Dim vbe As vbe
Dim nLines As Long


Set app = ThisApplication
Set vbe = app.vbe
Debug.Print vbe.VBProjects(1).Name
nLines = vbe.VBProjects(1).VBComponents(1).CodeModule.CountOfLines
Debug.Print vbe.VBProjects(1).VBComponents(1).CodeModule.DeleteLines(1, nLines)
End Sub
Message 7 of 11
Anonymous
in reply to: Anonymous

Thanks Anton.  Just starting to look into how
to handle this idea...


--
Sean Dotson, PE

href="http://www.sdotson.com">http://www.sdotson.com

Check the Inventor
FAQ for most common questions

href="http://www.sdotson.com/faq.html">www.sdotson.com/faq.html

-----------------------------------------------------------------------


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

You want probably something like the code below.
Use the Local WIndows
to explore the posibilities.
I don't think you can delete or unload entire
files.

'you need a reference (VBA: Tools>Reference, VB>Project>Reference)
to:
' Microsoft Visual Basic for Applications Extensibility 5.3
Sub
Main()
    Dim app As Application

    Dim vbe As vbe
    Dim
nLines As Long


Set app = ThisApplication
    Set vbe = app.vbe

    Debug.Print vbe.VBProjects(1).Name

    nLines =
vbe.VBProjects(1).VBComponents(1).CodeModule.CountOfLines

    Debug.Print
vbe.VBProjects(1).VBComponents(1).CodeModule.DeleteLines(1, nLines)
End
Sub

Message 8 of 11
avbuiten
in reply to: Anonymous

With pleasure.
Message 9 of 11
Anonymous
in reply to: Anonymous

Hello,

What else can you do with this Applications
Extensibility library?  Could this library be used for comprehensive
error logging?  I've heard about error classes..... and that's about it,
I've spent a long time thinking about howpeople make them and how people
implement them.  I feel it would be good idea to have an error log
available when beta testing an add-in and it decides to throw a
wobbly,I think this library is the interface I have been looking for, my
perceptions of the library lead me to belive I could get the exact line
number, procedure etc, I think it may be possible to monitor the variables being
used in this case aswell in my add-in when it breaks.

 

.... I don't know, just thinking aloud, wondering,
any thoughts, suggestions, corrections greatly appreciated.

 

Thanks

 

Scott
Message 10 of 11
Anonymous
in reply to: Anonymous

..... don't know about anyone else, my help won't
work for this library, bit of a bummer under the circumstances, can some one
suggest where I can get them from.

 

Thanks

 

Scott
Message 11 of 11
Anonymous
in reply to: Anonymous

Have you tried google Scott?

http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=%22Applications+Extensibility+library%22

--
Kent Keller
http://www.MyMcad.com/KWiK/Mcad.htm

Assistant Moderator
Autodesk Discussion Forum Moderator Program

"Scott" wrote in message
news:78D55D7A1394C0875771C677467A4932@in.WebX.maYIadrTaRb...
> ..... don't know about anyone else, my help won't work for this
library, bit of a bummer under the circumstances, can some one suggest
where I can get them from.
>
> Thanks
>
> Scott

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report