Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Programming Hints

Status
Not open for further replies.

Nullsweat

Technical User
Mar 13, 2003
16
US
Hola :)

I always see the
Dim fs, f, f1, fc, s, sf
Dim ofile As String
Dim fpath As String

'Find old import text files in Imported_Data directory and delete
Set fs = CreateObject("Scripting.FileSystemObject")


I am semi-proficient in macros, but I have no idea what this stuff is, other than setting constants="to something".

Does anyone know of a good book to read to learn about these??? Thanks in advance :)
Sean
 
Hi Nullsweat,

This is from the VBA help files
it will get you started

When declaring variables, you usually use a Dim statement. A declaration statement can be placed within a procedure to create a procedure-level variable. Or it may be placed at the top of a module, in the Declarations section, to create a module-level variable.

The following example creates the variable strName and specifies the String data type.

Dim strName As String

If this statement appears within a procedure, the variable strName can be used only in that procedure. If the statement appears in the Declarations section of the module, the variable strName is available to all procedures within the module, but not to procedures in other modules in the project. To make this variable available to all procedures in the project, precede it with the Public statement, as in the following example:

Public strName As String

For information about naming your variables, see "Visual Basic Naming Rules" in Visual Basic Help.

Variables can be declared as one of the following data types: Boolean, Byte, Integer, Long, Currency, Single, Double, Date, String (for variable-length strings), String * length (for fixed-length strings), Object, or Variant. If you do not specify a data type, the Variant data type is assigned by default. You can also create a user-defined type using the Type statement. For more information on data types, see "Data Type Summary" in Visual Basic Help.

You can declare several variables in one statement. To specify a data type, you must include the data type for each variable. In the following statement, the variables intX, intY, and intZ are declared as type Integer.

Dim intX As Integer, intY As Integer, intZ As Integer

In the following statement, intX and intY are declared as type Variant; only intZ is declared as type Integer.

Dim intX, intY, intZ As Integer

You don't have to supply the variable's data type in the declaration statement. If you omit the data type, the variable will be of type Variant.

With regards

Mike

 
Sean,

Check out j-walk.com -- John Walkenbach has written some really good books on Excel and Excel VBA.

And...

post your questions here at Tek-Tips. You'll get LOTS of specific help.

Use the Macro Recorder to record stuff you want to automate. Then look at the code. It usually needs to be modified to be useable in a general way. You can lear alt there.

Also check the FAQs in this forum.

Happy VBA coding :)

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884

Skip,
 
Thanks to all
Both answers are good places to start
Sean :)
 
Check out eBay before you run down to Borders. I picked up a brand new, CD sealed, copy of Excel 2000 Power Programming with VBA by John Walkenback for $18. That includes shipping. Borders is $50.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top