Consulting

Results 1 to 3 of 3

Thread: Help

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Mar 2018
    Posts
    1
    Location

    Help

    Hi everyone,
    I am an engineer by profession, have been using excel for long but new to vba.

    I just want to learn & explore the hidden world behind vba. Please suggest me some good readings or any type of material that can help.

    I want to make clear that I don't even have the concept of object in programming.

  2. #2
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    Very briefly, an Object is a thing, like a bolt or motor. An object has Properties... A Bolt has a length Property, a thread Pitch Property, and even a nut Property. To keep things straight in my head, I call Properties that Return an Object, "Object Type Properties," but VBA doesn't make that distinction... Ya gotta know.

    IMO, Excel is the best learning platform for Visual Basic for Applications. If you can find a cheap legacy ersion, (97 to 2003,) they will have the best built-in help files. The later versions only use online helps.

    To return to the nuts and bolts of Excel Objects, A Cell or Range in Excel has a Value Property, which is the number or words(s) in the Cell, an Interior Property, ("Object Type Property,") which can be colored. The Interior Property has a ColorIndex Property to which you assign different values to change the color of the Interior of the Cell.

    Some Objects have Methods. Some motors have a Start Method and a Run method. Methods do things

    Some Objects have Events. Torque To Yield bolts have a Stretch Event, when you should stop torquing them. Some motors have an Overheat Event, which triggers the stop Method of the Motor.

    VBA uses the "Dot" syntax for connecting Objects and Properties and Methods

    Workbooks("MyBook.xls").Sheets("Sheet1").Range("A1").Interior.ColorIndex = 3
    Workbooks and Sheets are Built-in Collections. The Parentheses enclose the Alpha Index of the desired Item in the Collection. They also have a numerical index.
    ColorIndex is a Property of the Interior Object which is a (object) Property of the Range Object, which is a (object returning) property of the Sheet Object, which is a (object) Property of the Workbook.

    Bridges("Kalamazoo").Girders("1A2B3").TensionalStrength = 100000PSI
    Radios("Heathkit").Models("482394").Diodes("D103").ContinuousMaxPower = 10W
    Manufacturers("Chevy").Engines("454").Cylinder.Diameter = 4"
    Manufacturers("Chevy").Engines("454").Cylinder.Piston.Types("HiPerformance" ).Domed = True
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  3. #3
    VBAX Expert Logit's Avatar
    Joined
    Sep 2016
    Posts
    606
    Location
    .
    Everyone learns differently. Some are ok reading a book ... others need hands-on instruction with lots of help - others may learn best by visual methods. In any case here are a bunch of references
    for you to review. Hopefully something here will assist : (see attached).

    I learned thru creating a personal project and asking questions on this and other forums.
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

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