how to run a VBA macro Inside another vba macro ??

how to run a VBA macro Inside another vba macro ??

almutaz_86
Advocate Advocate
2,220 Views
7 Replies
Message 1 of 8

how to run a VBA macro Inside another vba macro ??

almutaz_86
Advocate
Advocate

Good Evening AutoCADian  people 

I have some problems with vba, I'll try to explain it simply :

 

I draw boxes and rectangles in several measurements using  vba userform ,and I want to run another vba macro ( for draw circles on specific face(s) )- there is an attachment- some times on one face ,some times on 2 faces ....

how to run macros on right ,front or other sides of the box in vba ?

if it not possible, can I run a circles vba macro inside boxes vba macro  and make it together ?
thanks 

0 Likes
Accepted solutions (1)
2,221 Views
7 Replies
Replies (7)
Message 2 of 8

almutaz_86
Advocate
Advocate

@Alfred.NESWADBA

If you may to see this please

 

Sorry for annoying

Smiley Very Happy

 

0 Likes
Message 3 of 8

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> how to run macros on right ,front or other sides

>> of the box in vba ?

May I ask which part is the question?

  • how to run macros (as you are in a form)
  • create circles on some sides

 

In general, I guess it does not really make sense to draw circles on the surface of a 3D-object, what is the final goal with that? Creating bore oles?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 4 of 8

almutaz_86
Advocate
Advocate

Yes, exactly 

Its for creating bores

There is a message in your inbox 

0 Likes
Message 5 of 8

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

I have got your PM, this question is open:

 

May I ask which part is the question?

  • how to run macros (as you are in a form)
  • create circles on some sides

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 6 of 8

almutaz_86
Advocate
Advocate

Good evening Mr @Alfred.NESWADBA 
I'm sorry , I didn't read your question in your previous reply.

 

1-  I want to make a VBA macro {boring.dvb} to create circles from front,back,left or right view

 (independently for each side) 


2-  Then active it in another macro {DividedCabinet.dvb} on Right side (for example).

 

center(0) =100: center(1) = 100 : center(2) =100
        length = 200: width =200: height =200
        Set box1 = ThisDrawing.ModelSpace.AddBox(center, length, width, height)

      ' then call (right side boring) macro to make bores on right side
center(0) =500: center(1) = 500: center(2) =500 length = 150: width =150: height =150 Set box2 = ThisDrawing.ModelSpace.AddBox(center, length, width, height) ' then call (front side boring) macro to make bores on front

sorry .. I'm weak in English, I hope that was clear   🙂

and thank you for your Help

 

0 Likes
Message 7 of 8

Alfred.NESWADBA
Consultant
Consultant
Accepted solution

Hi,

 

so when you started your code from "UserForm1" within "dividedcabinet" and you want to start a code from another module ("boring.dvb") you need to

  • define different names for the projects (yours are both named "ACADProject")
  • in the dividedcabinet you need to add a reference to the boring project (in VBAIDE menu Tools ==> References
  • declare a public sub or public function in the "boring.dvb" that can be called from the caller project
  • now you can call this sub or function

 

 

20181217_122103.png

20181217_122214.png

20181217_122408.png

20181217_122557.png

 

HTH, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
Message 8 of 8

almutaz_86
Advocate
Advocate

Thank you for your efforts 

Great explaining 

I'm new in programming  I trying to learn it

Thanks again 👍🏻

0 Likes