PDA

View Full Version : VBS recommendations?



wonderjet
11-10-2007, 07:10 PM
Hey there,

In the past, I have learned bits and pieces of many different languages. However, VBS resources seem to be really limited relative to other programming or scripting languages, and Im really not sure why, as it seems to be really easy, and majority of people use windows, which vbs is made for automating.

I've started learning VBA for excel, but quickly realized that many of the automations i wish to have has to do with automating windows explorer (not internet explorer), which is what VBS is made for.

Has anyone come across any good resources on the net? Even at Chapters or amazon, the books on VBS are practically zero when compared to say VBA fro excel. Thanks for any pointers!

Bob Phillips
11-11-2007, 03:20 AM
VBS and VBA are so similar, it hardly seems worth a book. The main difference is that VBA has to be hosted, and naturally interacts with the host's object model.

wonderjet
11-11-2007, 10:58 AM
VBS and VBA are so similar, it hardly seems worth a book. The main difference is that VBA has to be hosted, and naturally interacts with the host's object model.

Hey xld, I'm wondering if your comment implies that anything one can do in VBS can be done in VBA (from within excel for example)? I guess I could see this being true, but likely a lot more coding? I dunno, it seems worth a book to me, but perhaps I havent grasped the big picture of the two (or rather, where they might exactly intersect)

Bob Phillips
11-11-2007, 11:50 AM
I would have thought yes, probeably with LESS coding, if you utilise built-in Excel functionality.

Don't forget, even with VBS, you can kick off an Excel session and then gain access to the Excel object model.

I haven't used VBS in quite a while, so I forget how you run API calls, but I am sure it is possible, just like in VBA.

They intersect in VB, they are both supersets of VB, and they use all of the common syntax rules, all the same constructs etc. As an example, I once took a VBS script that got the time from a US miltary server and converted it to VBA. Took me less than half an hour, and that was mainly changes due to my prejudices regarding style and the like.

wonderjet
11-11-2007, 12:40 PM
I would have thought yes, probeably with LESS coding, if you utilise built-in Excel functionality.

Don't forget, even with VBS, you can kick off an Excel session and then gain access to the Excel object model.

I haven't used VBS in quite a while, so I forget how you run API calls, but I am sure it is possible, just like in VBA.

They intersect in VB, they are both supersets of VB, and they use all of the common syntax rules, all the same constructs etc. As an example, I once took a VBS script that got the time from a US miltary server and converted it to VBA. Took me less than half an hour, and that was mainly changes due to my prejudices regarding style and the like.

So I guess essentially its just a matter of scope and where you are getting access from. Things would probably look a lot less pretty if you are in the excel scope, when in actuality you are just working from there out of convience of knowing that enviroment well to access the windows script host stuff in order to make new folders or generally just work with your windows explorer.

Seeing as I am learning VBS and VBA sort of at the same time and VBS is simpler (a subset of VBA), I see myself trying to learn the VBS way first, although the crux is there are less resources to learn it directly. In anycase Im sure ill figure it out one way or another, but like anything to do with programming, it might take a while:P