Want to learn VBA for Microstation, Online Coarse or book, or VB scripting. - Everything Else Forum - Everything Else - Bentley Communities

Want to learn VBA for Microstation, Online Coarse or book, or VB scripting.

I want to learn to make program using VBA for Microstation. I would prefer to learn VBA not MDL since I would use that language or Excel or any other windows programs. I found a college coarse for Introductory to VBA. Which is not geared to any one windows program like Microstation. I assume this is not the best coarse to teach me how to program for Microstation. Any advise what kind of coarse I should be looking for, maybe VB scripting?  I am not quite clear what is the difference between VBA vs VB scripting.  Maybe some kind of training book instead?

 I want to automate some routine task we do in Microstation. I have learned to program from a book before, with AutoLisp (autocad), which I greatly enjoyed. So I have some experience in programming. I am hoping to ideally spend 40hours learning VBA through a coarse or book, not sure if that is realistic. Any advise of what kind of coarse or book. If VBA scrip is the way for me, where can I find a coarse or which tutorial book would you recommend. Thanks.

20 Replies

  • Hello lbbss,
    There is a pretty good guide delivered with MicroStation located in the
    MicroStationVBA.chm file.

    Don't know of any VBA for MicroStation classes but there is a good book for
    learning:

    Learning MicroStation VBA by Jerry Winters published by Bentley Institute
    Press

    You can order it from Amazon or Bentley for about $90

    > I want to learn to make program using VBA for Microstation. I would
    > prefer to learn VBA not MDL since I would use that language or Excel
    > or any other windows programs. I found a college coarse for
    > Introductory to VBA. Which is not geared to any one windows program
    > like Microstation. I assume this is not the best coarse to teach me
    > how to program for Microstation. Any advise what kind of coarse I
    > should be looking for, maybe VB scripting? I am not quite clear what
    > is the difference between VBA vs VB scripting. Maybe some kind of
    > training book instead?
    >
    > I want to automate some routine task we do in Microstation. I have
    > learned to program from a book before, with AutoLisp (autocad), which
    > I greatly enjoyed. So I have some experience in programming. I am
    > hoping to ideally spend 40hours learning VBA through a coarse or book,
    > not sure if that is realistic. Any advise of what kind of coarse or
    > book. If VBA scrip is the way for me, where can I find a coarse or
    > which tutorial book would you recommend. Thanks.
    >
  • In reply to Mike Robertson:

    Actually, there are onDemand eLearning courses for MicroStation VBA -- those can be found starting on http://www.bentley.com/en-US/Training/Products/Resources/Books/

    More details on the "Learning MicroStation VBA" Bentley Institute book mentioned can be found on http://www.bentley.com/en-US/Training/Products/Resources/Books/Learning+MicroStation+VBA.htm


    This is a test

  • In reply to Phil Chouinard - Bentley:

    I could not find a VBA online course, I found many other topics but not VBA. I toward taking the online course. Does the on line course include online assistance with the VBA exercises?   Also, do you get some kind of college credit upon completion of test? 

    Thanks.

  • In reply to lbbss:

    Here is one way to find those:

    1. Go to http://lms.bentley.com/globalelearning/DesktopDefault.aspx?tabindex=5&tabid=255
    2. Under "Set search criteria", tick the Title box and enter VBA in the field next to it
    3. Tick the Description box and enter VBA in the field next to it
    4. Under "Select catalogs to search", tick the box to the left of Name
    5. Scroll down and click the Search pushbutton


    This is a test

  • In reply to Phil Chouinard - Bentley:

    I was hoping to find out the prices for these courses, but it prompts for a user name and password.    It would not recognize my user name and password  "user name does not exit".   Do I need a different user name, then what I am using to post on this forum?  tx
  • In reply to lbbss:

    Yes, that login is separate from Be Communities. We intend to have a single sign-on across all of our Web properties, but that does not exist today.


    This is a test

  • In reply to Phil Chouinard - Bentley:

    I bought the Microstation vba book from Bentley Institute Press that came with a CD, but the cd is blank.   Can someone post this file on this forum.   I can see it has some data on the cd, due to the lines that are burned on the data side.   I tried both windows explorer and Microstation VBA Project manager, but no luck.   The cd is clean and no scratches.   I bought it about a year ago, but have not had time till now to get into it.    Phil not sure if you have this in your library.    thanks. 

    this is the book I have 

    http://www.bentley.com/en-US/Training/Products/Resources/Books/Learning+MicroStation+VBA.htm  

  • In reply to ball888:

    There is a lot of stuff on that CD, way too much to "post this ... on this forum". Please contact me (offline) with your contact information and we will look into getting another CD out to you.


    This is a test

  • In reply to Phil Chouinard - Bentley:

    wow, that was quick.   Ok I found your email, will send you my info.  tx

  • In reply to Phil Chouinard - Bentley:

    I recently bought the book By Gerry Winters (learning MicroStation VBA) and I am really disappointed, I have very little VBA skills and I was hoping to improve them by purchasing this book. Everything went smoothly until chapter 5. I followed all the instructions in Chapter 5, Modules, Forms and Class Modules. I discovered that there are some steps left out in his instruction or else he did not properly review this part. He does not properly explain the steps to get this exercise working. If you have to try and follow this exercise step by step you will discover that it is absolute gibberish to a beginner.

  • In reply to Bliksem:

    Microsoft VBA is derived from Microsoft Visual Basic (VB).  Microsoft provide a VBA Toolkit so other parties, such as Bentley Systems, can incorporate VBA into their products.  As a result, MicroStation VBA is similar to other VBAs.

    Features common to all VBAs include the Interactive Development Environment (IDE), the various module types (Modules, Forms and Class Modules) and the language syntax.  The way the various VBAs differ is in the extensions they offer for a specific application.  For example, Word VBA offers ways to handle paragraphs of text; Excel VBA provides ways to handle data in a worksheet; MicroStation VBA provides ways to manipulate graphic elements in a DGN model.

    Look at other VBAs

    If you're struggling with MicroStation VBA, take a look at the way other vendors do it.  While there's only the one book about MicroStation VBA, there are plenty of others that provide sound advice for Word VBA, Excel VBA, etc.  There are also plenty of websites that deal with VB/VBA.

    I find that when one viewpoint doesn't help me understand a technical issue, often another viewpoint approaches the subject in a different way.  That different approach may illuminate a topic and lead you to that Bingo! moment.  Get hold of  a book about Excel VBA, and see if that discusses Modules, Forms and Class Modules in a way that is more enlightening for you.

    Regards, Jon Summers
    LA Solutions


  • In reply to Bliksem:

    Bliksem
    I followed all the instructions in Chapter 5, Modules, Forms and Class Modules. I discovered that there are some steps left out in his instruction or else he did not properly review this part.

    I am not only new to Microstation vba but also vba in general. I agree, is difficult to follow the book. I did manage to get chapter 5 to work with the class module. First off I did not have my class module named clsTarget as the instructions said. Second, on page 53 the screenshot does not match the code listed at the bottom of the page at the part where it reads "And here is the code as it should be typed:" eventhough they are supposed to be the same. My code did not match the screenchot(which is correct) I typed my code to match the bottom of the page. The difference between the codes is the first line after the "Public" statements:

    Sub Draw(X as Double, Y as Double, Z as Double)

    The screenshot just shows Sub Draw()

    After removing the "Double" statements the program ran fine. I pulled my hair out trying to figure this out!

    I am currently using Microsoft's site for a learning vba tutorial for a better understanding of vba before moving forward with Microstation vba.

  • In reply to mwlong:

    Bliksem,

    I have to agree with you. For a $90 book to have mistakes like this is unconscionable. It is difficult enough to learn a new programming language without having to fight with code that obviously has not been proofread. I looked online for a least an errata sheet but apparently none exists. Bentley is obviously aware that this book has errors. Come on Bentley, how about a simple errata sheet?

  • In reply to bugzbunny:

    bugzbunny

    Come on Bentley, how about a simple errata sheet?

    If you have any specific for instances, we will certainly look into them. TIA


    This is a test

  • In reply to Phil Chouinard - Bentley:

    Let me start with two in Chapter 5 that would be helpful,

    First, as Bliksem mentioned, the code on page 53 (towards the bottom of the page) has:

    Sub Draw (X As Double, Y As Double, Z As Double)

    That code will cause the program to fail. The correct code should be:

    Sub Draw()

    If you'll notice, the screen shot on the same page has the correct code.

    Another thing that would be useful (particularly to new programmers) is if somewhere in the text it mentions that the coding in Chapter 5 should be done using the design file called "Nothing.dgn." I started entering code using one of my blank design files and couldn't get the code to work. After just a bit of snooping, it occurred to me that the call to "nothing" wasn't a VBA call or variable, it was just the name of the design file. Might be nice if Jerry had mentioned that somewhere.

    I'll post any other problems as I come to them. I'm going to let the typos side (at least three in Chapter 5 and 6) because, after all, it is a technical book and grammar has no place in technology.

  • In reply to bugzbunny:

    Got another one for you that I ran into today.

    In Chapter 10 we start in with the user interface on Page 167. A new form is created, a bunch code is added. You get to page 173 and a three line code is added which starts up the form. The code is:

    Sub DoCellInsertion()

      frmCellInsertion.Show vbModeless

    End Sub

    Great. The problem is, no where did it say to rename the form to "frmCellInsertion". So, if you are new to VB and you see that call, you probably aren't going to realize that it is calling the form by its name. It should be mentioned on page 168 when you are building the form that the name of the form needs to be changed.

  • In reply to bugzbunny:

    I should get paid for this.

    Page 174, the Point List Reader. Thing is, it doesn't seem to work. Not by keying the code from the book or running the code from the CD.

    In the subroutine btnRead, the debugger doesn't seem to like the line:

    Open txtPointFile.Text For Input As #FFile

    Soooo... I'll try to brute force this one to figure out why it doesn't work, but, you know, an errata sheet... just sayin

  • In reply to bugzbunny:

    Thanks... we will look into these things.


    This is a test

  • In reply to bugzbunny:

    Well the three lines of code that are relevant here would be:

    Dim FFile As Long ' declare a variable to hold a long integer

    FFile = FreeFile ' VBA function FreeFile gets the next available file number

    Open "fileName" For Input As #FFile ' open a text file of name "fileName" to read in and use file number FFile

    This is common VBA code.  If you tried to put #FFile in the debugger it would be a problem.  What is the value of FFile after the assignment from FreeFile?

    HTH,

    mark anderson [Bentley]

    Visit me at https://communities.bentley.com/communities/other_communities/bentley_innovation/default.aspx 


    This is a test

  • In reply to Mark.Anderson:

    Mark,

    Thanks for the response. I suppose to find the value of FFile, you'd have to use the Watch Window. Unfortunately, I haven't gotten to that chapter yet, I'm only to chapter 14. But, when I do get a bit further along, I'll revisit this code to see if I can work through it. But, in the meantime, you might want to take a look at the book (Learning MicroStation VBA) and eyeball the code for the Point List Reader on page 174. The code in the book and the CD doesn't appear to work... not for me anyway.

    Regards,

    Jon

Recommended
Related