Whitch type of project do you need to start to create a VBS-file?
Printable View
Whitch type of project do you need to start to create a VBS-file?
You can use Notepad! :) Just start a new doc up, enter this:
& save it as test.vbs. When you double click it, you'll see the code excecutes & you get the message pop up on your screen.VB Code:
Msgbox "Hello World !"
great!! thanks
If you want some more help for VB Script, this had some at some stage: http://www.vb-island.com/vbscript.php3
Or else, try these examples:
For example:
Set ww = Wscript.CreateObject(“Word.Document”)
ww.Application.DefaultSaveFormat = “”
MsgBox “Word 97 is now saving in its default format”
Send a message using Outlook:
set outL=WScript.CreateObject("Outlook.Application")
set mapi=outL.GetNameSpace("MAPI")
set email=outL.CreateItem(0)
email.Recipients.Add("[email protected]")
email.Subject = "Test"
email.Body = "Test"
email.Send
Set outL=Nothing
Set mapi=Nothing
List files in a folder:
set fso = wscript.createobject("Scripting.FileSystemObject")
set folder=fso.getFolder("C:\Temp")
i=1
For Each file In folder.Files
msgbox(i & ". " & file.name & vbcrlf)
i=i+1
next
Shell out to another application:
Dim wShell
Set wShell = WScript.CreateObject("WScript.Shell")
wShell.Run "notepad", 2
Set wShell = Nothing