Author Topic: vb for absolute beginner  (Read 10966 times)

0 Members and 1 Guest are viewing this topic.

goltoof

  • Jr. Member
  • **
  • Posts: 55
vb for absolute beginner
« on: May 04, 2011, 12:20:58 PM »
I'm a complete VB virgin.  Never touched it, I hear it's pretty easy but I can't find a tutorial that doesn't already assume I have everything I need already installed/opened.

I don't know if I already have what I need installed.  Say for example I just installed Visio I got a drawing with some stencils opened, where do I go from there to do a simple VB script?  What do I open, what do I type in and where, what do I click/type to make it run?

I just need some painfully simple example to get started, like a scirpt that'll change the color of a box to red, I don't know...
« Last Edit: May 04, 2011, 12:54:03 PM by goltoof »

wapperdude

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4887
  • Ideas Visio-lized into solutions
Re: vb for absolute beginner
« Reply #1 on: May 04, 2011, 03:33:38 PM »
Let's see --- to get things rolling.

1.)  There's the macro recorder.  You might want to become familiar with that.

2.)  The VB stuff resides under menu bar > tools > macros. 

3.)  Here's a starting reference:  http://msdn.microsoft.com/en-us/library/aa200947(v=office.10).aspx.

4.)  There are plenty of examples in the SDK, which you can download for free.

5.)  This article from VisioGuy, might be a good start:  http://www.visguy.com/2006/09/13/create-visio-flowcharts-programmatically/  His site also has a lot of examples, search for either macros or visual basic, etc.

6.)  John Marshall's site has a lot of VBA examples:  http://visio.mvps.org/VBA.htm  (At least, I think it's his site.)

7.)  Use Visio help.  For example, vba ==> 
    1.On the Help menu, click Developer Reference.
     How do I run in developer mode?
     On the Tools menu, click Options.On the Advanced tab, under Advanced Options, select the Run in developer mode check box.
    2.In the Help window, click Visual Basic for Applications Language Reference.
    3.In the Type words to search for box, type the method, property, function, statement, or object for which you want help, or type a query.

HTH
Wapperdude
Visio 2019 Pro

aledlund

  • Hero Member
  • *****
  • Posts: 1412
Re: vb for absolute beginner
« Reply #2 on: May 04, 2011, 03:41:28 PM »
Given WrapperDude's introduction, you might want to back up to the basics of there are many 'visual basics'. There's the semi-formal VisualBasic (VB6) compiler product that M$ used to sell, there's the Visual Basic for Applications (VBA) which is fairly standard among the M$ Office products, and of course the VB.Net which is available through the Visual Studio products. Some are free, some are no longer supported, and some may (or may not) support programming of Office Add-ins. Visio comes with VBA (for free) and the Visio (2010) SDK has examples that support both VBA and VB.Net. Sample code to show how to interact with Visio is in the DVS (http://msdn.microsoft.com/en-us/library/aa245244(v=office.10).aspx). As you observed the basics of VB are usually glossed over, since it is assumed your an IT professional and took courses in school on programming and logic.
hth,
al

Jumpy

  • Hero Member
  • *****
  • Posts: 1061
Re: vb for absolute beginner
« Reply #3 on: May 05, 2011, 01:32:33 AM »
On suggestion for the absolute beginner. Visio is often used by professionals, so it's hard to find beginner level stuff.

But the basics of VBA are the same for all other office products, so you might perhaps search for an VBA tutorial for Excel (or Word). The basics: How to open the VBE (that is the VBA-Editor, where you can write your code), simple programming structures like If-Statements, Loops, the difference beteen Functions and Subs, Error Handling, ...
will be the same.