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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Script in Outlook XP

Status
Not open for further replies.

TimGoff

Technical User
Jul 16, 2002
166
GB
Hi,

I've done some work in Access/VBA but haven't touched upon VB Scripts before.

I'm writing some code on an Outlook form...this is basic stuff but...

a) The code falls over when I use a variable type in the declaration, but Dim strVariable works for some reason.

b) How transparent are the commands from VBA to VBscript?
eg I've tried putting in an error handler...

On Error Goto ErrorHandler


ErrorHandler:
msgbox ("Error")

etc

But I get errors using this...

Apologies this is entry level stuff but everything I've ever learned in VBA appears to have gone out the window!

Tim
 
Tim

Things are a bit different in VB Script.

a)Variable types are late bound so no type declarations are used

b)Error handling does not allow jumping to the end of a code segment. The On Error Resume Next is still available however.

You can use Arrays, User Defined Types and create your own classes in VBScript so things are quite similar really.

Any other questions people will be happy to help

Thanks,
Sunny
 
Hi Sunny,

Thanks for coming back so quickly...feel like a fish out of water with this really.

Can I ask...

Is the only error handling the On Error Resume next command?

I'm trying to read a text file on a server - with VBA I've used Line Input #1, strFile etc. How would I read it through VB script?

Thanks
Tim
 
Tim

The on Error Resume Next is pretty much it, there is an Err object - MSDN probably explains it better than I could so look at these links:



In terms of reading and writing from text files there is the wonderful FileSystemObject. Again MSDN has the reference for this


The FileSystemObject is pretty versatile I think you will like it, it can also be used in VB / VBA.

Hope this helps,
-Sunny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top