Author Topic: Rules of thumb for VBA programs  (Read 4046 times)

0 Members and 1 Guest are viewing this topic.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16723
  • Superior Stupidity at its best
Rules of thumb for VBA programs
« on: December 24, 2003, 08:55:46 AM »
There is one thing I have noticed about most VBA programming. People fail to realize that whenever you build a VBA program, whatever version of AutoCAD you have installed tends to interfere with the use of the program on other versions of AutoCAD. For example, If you develop a program in AutoCAD 2000, and the user has R14, the user will get a compile error because of a missing type library, or it will return an error stating that the function or sub is not defined.

It might be a good idea whenever we post VBA programs that we include the type llibraries required for the programs proper functioning. This can be found by listing the references in the VBA editor window and highlighting the checked type libraries.

First open the editor and select "References" on the tool menu


Then in the References window, highlight the checked item and you will see the reference to the file in the dialog. Make sure you attempt to uncheck ALL boxes after you have completed the project, this will make sure you are not telling people that they require a file that they do not really require.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Trev

  • Guest
Rules of thumb for VBA programs
« Reply #1 on: December 29, 2003, 04:38:56 AM »
Very good point Keb

daron

  • Guest
Rules of thumb for VBA programs
« Reply #2 on: December 29, 2003, 10:04:57 AM »
Keith, Trev and Hendie and anybody else who'd like to contribute. I have some web space that Mark has so graciously given me and really haven't been able to do much with it. I feel that there are enough lisp sites to go around. SMadsen has his and it is very good and I don't think I could do more except to refer others to his site. Se7en's site is good and geared towards picking up a function here and there. I don't feel there needs to be much more in the way of lisp. I know there are other sites out there for lisp and vba, but there isn't to my knowledge any vba sites in the swamp. So, I decided that I'd like to upgrade my site a bit and see if you guys would like to come up with some tutorials and maybe some functions that we could put on it to help others, such as myself, learn vba? I'd definately like to start with some tutorials on using the editor and learning the debug features. Maybe you guys could throw out some ideas of what would get this up and running and let me know if you'd be interested in writing something. When we get a few ideas, I'll make a list and post it. Then we can delagate who should write what, so we don't get one sided and have multiple tutorials of the same thing.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16723
  • Superior Stupidity at its best
Rules of thumb for VBA programs
« Reply #3 on: December 29, 2003, 10:33:54 AM »
Sounds like a good idea. I began learning VBA like so many others, simply be studying code and seeing what makes it tick. I was thinking that perhaps we could create a tools section that users could incorporate into their programs. For example I was looking at the code posted by Rugaroo and offered a suggestion and a short bit of code to add a drawing preview from VoloView in a form.

Here is another example to add a URL link in a form. Simply create a bit of text in your form, name it URL1 then paste the following code into the form code section.
Code: [Select]

 'Add the following lines to your UserForm_Initialize event
 'change to path of your desired cursor
 URL1.MouseIcon = LoadPicture("C:\WINNT\Cursors\url.cur")
 URL1.MousePointer = fmMousePointerCustom

 'Place this in the UserForm Code window
Private Sub URL1_Click()
 Dim IEApp As WebBrowser
 Set IEApp = CreateObject("InternetExplorer.Application")
 IEApp.Visible = True
 IEApp.Navigate URL1.Caption
End Sub

Quote

You will need to include the "Microsoft Internet Controls" shdocvw.dll in the references.


You will want to change the MouseIcon property to the icon you want to show over the url, I extracted and use the default Internet Explorer pointy finger
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Trev

  • Guest
Rules of thumb for VBA programs
« Reply #4 on: December 29, 2003, 11:11:44 AM »
Yes a very good idea Daron.
I have done a little hunting around on some tutorial
information on using the editor. I found  a few suitable things. I just have to sort it out and put it into something usable, giving a few examples etc.
I put it aside for a while but will take another look at it and see what I can come up with, then others can add or make suggestions etc. to make it better.

Also as Keith suggested a tools area that contains functions that would be used in many programs.
could be everything from how to populate a list box
with blocks or layername or from an external file to
how to link or open a database for writing to.
Small steps though. Tutorial first then simple samples then standard functions.
hows that sound?

daron

  • Guest
Rules of thumb for VBA programs
« Reply #5 on: December 29, 2003, 11:54:32 AM »
I like all your suggestions. I'd like to build it as we go.  Some sort of webl format would be great, but if not, I can convert it.

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16723
  • Superior Stupidity at its best
Rules of thumb for VBA programs
« Reply #6 on: December 29, 2003, 12:46:50 PM »
Well, ok I think we are in agreement then, Daron, if you will come up with some sort of web format to get us started, we can decide what content we need to include, then implement the things we want to develop. For example, if you can come up with a formatable web page where all we need to do is import content, then I think it would make it a whole lot simpler. Keep us informed of any development issues you might have or ideas you might want to incorporate.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

daron

  • Guest
Rules of thumb for VBA programs
« Reply #7 on: December 29, 2003, 12:50:15 PM »
Check your PM box and let me know if that is what you're thinking. Let me know if you didn't receive it too. I'm using Mozilla and there are some things I have yet to figure out.