does Vba access = excel ? (1 Viewer)

ijaz1976

Registered User.
Local time
Today, 08:01
Joined
Jan 30, 2011
Messages
28
i m new to access and do not know much about vba.
my question is does vba used in Ms Excel is same as the vba in Ms Access or these two differ from each other. in other words if someone knows usage of vba in Ms excel can he use same knowledge of vba in Ms access or he has to learn vba for ms access separately.
 

MarkK

bit cruncher
Local time
Today, 08:01
Joined
Mar 17, 2004
Messages
8,186
VBA is the same. But VBA is a procedural language you might use to automate objects. So in Access you use VBA to manipulate AccessObjects like forms, reports and so on. In Excel you use VBA to automate Excel objects like cells and ranges.
In this regard VBA is the easy part. The harder part is learning how to use the tools that you might use VBA to automate.
Cheers,
Mark
 

Galaxiom

Super Moderator
Staff member
Local time
, 01:01
Joined
Jan 20, 2009
Messages
12,853
As lagbolt says, the VBA procedures themselves are actually quite simple. Fundamentally it really it amounts to little more than controlling the excecution through logical tests and loops.

The real knowledge is about the properties and methods of collections and objects in the Office applications. Then there are the all the things in Windows itself that can also be used and maniputlated by VBA.

But it doesn't stop there. Developers can make their own collections and objects and assign properties and methods to them. Moreover there are just so many ways to achieve results, each with their individual strengths and weaknesses. Matching the right technique to the job is what it is all about.

The subject is vast and that is just the knowledge. To some extent, like any programming, working with VBA is an art. That is what makes it so rewarding.

Don't expect to ever know it all like you might know how to use a program. Always be on the lookout for other ways because you will stumble across them, especially here as there are so many contributing their art.
 

ijaz1976

Registered User.
Local time
Today, 08:01
Joined
Jan 30, 2011
Messages
28
thanks to you all. what i understand is usage of code is same in vba in any app just objects are changed in each application (access or excel). in other words logic remains same in any app. is this true ?
 

Galaxiom

Super Moderator
Staff member
Local time
, 01:01
Joined
Jan 20, 2009
Messages
12,853
Most Access developers find themselves working in Excel too. VBA in Access can directly refer to the Excel application and documents.

The logic is identical in all Office application and also VB Script. It is remarkable how little there actually is until you get to objects.

This handful of terms covers the logic:
If Then ElseIf Else Case

These terms cover the cycles:
Do For Each While Until Loop Next

In the objects the structure is very orderly.
Learn how to enumerate their Properties and Methods.

Understand the nature of variables.
Always use Option Explicit and declare variable types.

Be sure to learn how to use these windows in in the VBA Editor.
Object Browser, Immediate, Locals, Watches

Google is the Developer's Friend. Most of what you need has been done before and blocks of code are readily available. However try to understand the blocks before you use them.

Persistence, persistence, persistence.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 16:01
Joined
Sep 12, 2006
Messages
15,658
one difference seems to be that the usage of the actual objects (eg forms) and event models are slightly different in access and excel

I definitely find excel more intractable than access in this respect.
 

Galaxiom

Super Moderator
Staff member
Local time
, 01:01
Joined
Jan 20, 2009
Messages
12,853
I definitely find excel more intractable than access in this respect.

The sheer number of Properties and Methods of the Range and Selection Objects in Word and Excel are spectacular particularly when you account for the number of arguments they furnish.

http://msdn.microsoft.com/en-us/library/aa223084(v=office.11).aspx

Rather than digging for them I often record a short macro to see what it used. Usually needs considerable refinement but it heads in the general direction.
 

Users who are viewing this thread

Top Bottom