Page 1 of 4 1234 LastLast
Results 1 to 10 of 36

Thread: Best way to convert my VBA program

  1. #1
    I could stop if I wanted to CadDog's Avatar
    Join Date
    2005-06
    Location
    So Ca
    Posts
    439
    Login to Give a bone
    0

    Default Best way to convert my VBA program

    Hi all,

    I have only two VBA program which
    I wrote a few of years going which
    are very handy to me and other users.

    I would like to convert these two programs
    over to vb.net (or whatever) for two reasons.

    One - I can start learning and write in a new form.
    Two - So I don't need to download any additional exe in the future.

    Any guide or link which would help me get started would be welcome.

    Thanks...

    My search code:
    caddogVBA01

  2. #2
    All AUGI, all the time
    Join Date
    2003-10
    Posts
    706
    Login to Give a bone
    0

    Default Re: Best way to convert my VBA program

    Check out the "sticky" threads at the top of the .NET forum here. they really help out and get ya started quick. Especially the tutorial videos and the AutoCAD developer's guide link. It didn't take long for me to rewrite a lot of my proggys. Of course I now have more questions than answers but it's still a step in the right direction.

  3. #3
    I could stop if I wanted to CadDog's Avatar
    Join Date
    2005-06
    Location
    So Ca
    Posts
    439
    Login to Give a bone
    0

    Default Re: Best way to convert my VBA program

    Thanks Coolmo I will do...

    I looked so hard I missed that...


  4. #4
    I could stop if I wanted to CadDog's Avatar
    Join Date
    2005-06
    Location
    So Ca
    Posts
    439
    Login to Give a bone
    0

    Default Re: Best way to convert my VBA program

    Thanks fixo for your offer,

    I will send you the code to see if you can change it over to VB.net...

    Hope you feel and get better very soon...


  5. #5
    All AUGI, all the time
    Join Date
    2003-10
    Posts
    706
    Login to Give a bone
    0

    Default Re: Best way to convert my VBA program

    Quote Originally Posted by CadDog View Post
    Thanks fixo for your offer,

    I will send you the code to see if you can change it over to VB.net...

    Hope you feel and get better very soon...


    Sounds like a cool competition. Post the code or give us an idea as to what it does and we'll compete for the coolest .NET version!

    Or not... just a thought

  6. #6
    I could stop if I wanted to CadDog's Avatar
    Join Date
    2005-06
    Location
    So Ca
    Posts
    439
    Login to Give a bone
    0

    Default Re: Best way to convert my VBA program

    Quote Originally Posted by Coolmo View Post
    Sounds like a cool competition. Post the code or give us an idea as to what it does and we'll compete for the coolest .NET version!

    Or not... just a thought
    Here you go:

    All I have it do is:

    • The user can call up a form with the use of a quick keyin
    • The form list department and the layer list they like using (per company or NSC)
    • The user select the layer to create and the program tells AutoCAD to create it.
    • The layer list are stored on txt files which can be changed at anytime.
    • Lastly, the program closes and uploads.

    Have a look:
    Attached Images Attached Images

  7. #7
    All AUGI, all the time
    Join Date
    2003-10
    Posts
    706
    Login to Give a bone
    0

    Default Re: Best way to convert my VBA program

    Pretty cool. What does the database TXT file look like? Comma delimited, etc.?

  8. #8
    I could stop if I wanted to CadDog's Avatar
    Join Date
    2005-06
    Location
    So Ca
    Posts
    439
    Login to Give a bone
    0

    Default Re: Best way to convert my VBA program

    Quote Originally Posted by Coolmo View Post
    Pretty cool. What does the database TXT file look like? Comma delimited, etc.?
    Yes it is...

    Here is that file:

    Code:
    Chain Link Fence Line	,C-Fenc,23,fence_x
    Barbed Wire Fence Line	,C-Fenc-Barb,23,fence_xx
    Wrought Iron Fence Line	,C-Fenc-Iron,23,m-fence_wi
    Construction Fence Line	,C-Fenc-Stru,2,fenceline3
    --------- Walls --------,0,7,Continuous
    Concrete Retaining Wall	,C-Wall-Conc-Rtwl,3,continuous
    CMU Retaining Wall	,C-Wall-Ccmu-Rtwl,3,continuous
    Block Wall (CMU)	,C-Wall-Bloc,2,continuous
    Stone Wall FenceLine	,C-Wall-Ston,23,continuous
    --------- Misc  ----,0,7,Continuous
    Stair & Yard Railing	,C-Fenc-Rail,1,continuous
    GuardRail (metal) Line	,C-Fenc-Grai,1,guardrail
    --------- By Others ----,0,7,Continuous
    Chain Link Fence Line	,C-Fenc-Byot,9,fence_x
    Structure Outline	,C-Bldg-Byot,9,Dashed2
    Will having the VBA code help you...???

  9. #9
    I could stop if I wanted to CadDog's Avatar
    Join Date
    2005-06
    Location
    So Ca
    Posts
    439
    Login to Give a bone
    0

    Default Re: Best way to convert my VBA program

    Here how I have put it together:

    >>> 1) AcadDoc.lsp :
    Code:
    ;;;	VBA Path
    (setq vbapath (strcat DriveL ":\\wheatjk\\apps\\autodesk\\Acad2008\\projects\\corp\\vba\\"))
    and for fun I also added:
    Code:
    ;Title name for layer lists used in QW
    (vl-registry-write "HKEY_CURRENT_USER\\SOFTWARE\\VB AND VBA PROGRAM SETTINGS\\DMJMAPPS\\\\AutoCad2008" "LayerMakerAcadMnuFileName"
    "DMJM | AECOM  Standard Layer Maker 2008")
    2) AcadDoc.lsp calls Abbre08.lsp:

    Code:
    (defun c:qw ( / filepath)
    ;;; Change vbaPath in the acad.lsp if location changes
      (if (setq filepath (findfile (strcat vbaPath "layermaker.dvb")))
        (progn
          (vl-vbaload filepath)
          (vl-vbarun "ThisDrawing.OpenLayerMaker")
          )
        (progn
          (princ "\nUnable to find VBA project file: LayerMaker.dvb")
          ))
      (princ)
      )
    
    (defun c:unloadQW ()
         (Setvar "cmdecho" 0)
           (vl-cmdf "vbaunload" (strcat vbaPath "LayerMaker.dvb"))
         (Setvar "cmdecho" 1)
         (princ)
        )
    With this active all the user need to do is type in on command line:
    QW (don't ask why QW... hahaha)

    Layer Maker just makes it easy for me to keep everyone standard and
    for the users to create a layer (s) easy and fast.
    This help me not needing to create a template file with a million layers which
    makes it very hard user to find the one layer they need.
    Please don't purge those dwg files if you don't to remove all the layers...hahaha

    Here is the VBA file...
    Attached Files Attached Files
    Last edited by CadDog; 2010-04-21 at 07:29 PM.

  10. #10
    All AUGI, all the time
    Join Date
    2003-10
    Posts
    706
    Login to Give a bone
    0

    Default Re: Best way to convert my VBA program

    It's password protected and I don't have or know of all the "stuff" to just run it the way you do. Of course I'm sure it needs the TXT database file for the layers on startup.

    I have a very similar program like this where you have certain layer categories and then you can control the way and number of layers that come in with a simple click. It's also in VBA and I'm converting it now. I've become very lazy with this though because I have hundreds of programs in both AutoLisp and VBA that I'm converting over to VB.net.

    Did you check out the AutoCAD Developers guide and/or get a copy of VB Express yet?

Page 1 of 4 1234 LastLast

Similar Threads

  1. Convert old program to LISP
    By dandrejco in forum AutoLISP
    Replies: 3
    Last Post: 2012-10-12, 09:17 PM
  2. AutoLISP program to convert text styles
    By aaronic_abacus in forum AutoLISP
    Replies: 1
    Last Post: 2007-01-09, 08:51 AM
  3. Program to batch convert DWF to PDF
    By andytimpson in forum Software
    Replies: 7
    Last Post: 2006-10-20, 11:24 AM
  4. HPGL Convert program
    By bpurdie in forum Software
    Replies: 17
    Last Post: 2006-10-03, 02:49 PM
  5. Writing a Short program from Large Program
    By avinash00002002 in forum VBA/COM Interop
    Replies: 2
    Last Post: 2006-07-13, 01:26 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •