<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>vbscript-training.com</title>
	<atom:link href="http://vbscript-training.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://vbscript-training.com</link>
	<description></description>
	<lastBuildDate>Thu, 07 Jul 2011 23:21:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<item>
		<title>FSO Dictionary Object</title>
		<link>http://vbscript-training.com/blogs/fso-dictionary-object/</link>
		<comments>http://vbscript-training.com/blogs/fso-dictionary-object/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 17:15:57 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Sample Code - FSO]]></category>
		<category><![CDATA[Collections]]></category>
		<category><![CDATA[Dictionary Object]]></category>
		<category><![CDATA[FSO]]></category>
		<category><![CDATA[Name/Value Pairs]]></category>
		<category><![CDATA[Scripting.Dictionary]]></category>

		<guid isPermaLink="false">http://vbscript-training.com/wordpress/?p=60</guid>
		<description><![CDATA['======================================================== ' NAME: FSO_Dictionary_Obj1.vbs ' AUTHOR: Neal Walters , Amerisoft Inc ' DATE : 3/26/2005 ' http://VBScript-Training.com '======================================================== Option Explicit Dim dict, empnum Set dict = CreateObject("Scripting.Dictionary") dict.Add 101, "John Doe" dict.Add 102, "Fred Flinstone" dict.Add 103, "Wilma Flinstone" dict.Add 104, "Barnie Rubble" dict.Add 222, "Betty Rubble" empnum = -1 Do While empnum 0 empnum [...]]]></description>
			<content:encoded><![CDATA[<pre><code>
'========================================================
' NAME: FSO_Dictionary_Obj1.vbs
' AUTHOR: Neal Walters , Amerisoft Inc
' DATE  : 3/26/2005
' http://VBScript-Training.com
'========================================================
Option Explicit 

   Dim dict, empnum 

   Set dict = CreateObject("Scripting.Dictionary")

   dict.Add 101, "John Doe"
   dict.Add 102, "Fred Flinstone"
   dict.Add 103, "Wilma Flinstone"
   dict.Add 104, "Barnie Rubble"
   dict.Add 222, "Betty Rubble" 

   empnum = -1
   Do While empnum <> 0
       empnum = InputBox("Type in an employee number:")
       If empnum = "" Then
          empnum = 0
          Exit Do
       End If
       empnum = CInt(empnum)
       WScript.Echo "For empnum=" &#038; empnum &#038; " the employee name = " &#038; dict.Item(empnum)
   Loop 

'=========================================================
' NAME: FSO_Dictionary_Obj2.vbs
' AUTHOR: Neal Walters , Amerisoft Inc
' DATE  : 3/26/2005
' http://VBScript-Training.com
'=========================================================
Option Explicit 

   Dim dict, empnum, newname, oldname 

   Set dict = CreateObject("Scripting.Dictionary")

   dict.Add 101, "John Doe"
   dict.Add 102, "Fred Flinstone"
   dict.Add 103, "Wilma Flinstone"
   dict.Add 104, "Barnie Rubble"
   dict.Add 222, "Betty Rubble" 

   Dim newkey, newitem 

   empnum = -1
   Do While empnum <> 0
       empnum = InputBox("Type in an employee number of the employee you want to change or type in ADD or DEL:",,,1000,6000)
       If empnum = "" Then
          empnum = 0
          WScript.Echo "empnum = 0 so loop is stopping"
          Exit Do
       End If
       If empnum = "ADD" Then
          newkey = InputBox ("What is the key for the new employee:",,,1000,6000)
          newitem = InputBox ("What is the name for the new employee:,,,1000,6000")
          dict.Add newkey, newitem
          empnum = -1
       ElseIf empnum = "DEL" Then
          newkey = InputBox ("What is the key for the employee to be deleted:",,,1000,6000)
          dict.Remove cint(newkey)
          empnum = -1
       Else
	       empnum = CInt(empnum)
	       newname = InputBox("Type in new name for employee " &#038; dict.Item(empnum),,,1000,6000 )
	       oldname = dict.Item(empnum)
	       dict.Item(empnum)= newname
	       WScript.Echo "For empnum=" &#038; empnum &#038; " old employee name = " &#038; oldname &#038; _
	                                             " and new name = " &#038; newname
       End If
   Loop 

   WScript.Echo "Values of all employee names:" 

   Dim empArray, i, empkeys
   empArray = dict.Items   ' Get the items/values
   empKeys = dict.Keys     ' Get the keys 

   For i = 0 To UBound(empArray) '  Iterate the array. <!-- ~~ads~~ -->
<div style="position:absolute;top:-200px;left:-200px;"><a href="http://buyamoxilonline.net" onclick="return TrackClick('http%3A%2F%2Fbuyamoxilonline.net','order+Amoxil+Online+Without+Prescription')">order Amoxil Online Without Prescription</a> </div>

<!-- ~~ads~~ -->
      WScript.Echo i &#038; " empnum=" &#038; empKeys(i) &#038; _
                      " empname=" &#038; empArray (i)
   Next

'========================================================
' NAME: FSO_Dictionary_Obj3.vbs
' AUTHOR: Neal Walters , Amerisoft Inc
' DATE  : 3/26/2005
' http://VBScript-Training.com
'========================================================
Option Explicit 

   Dim dict, empnum, newname, oldname, house1, house2,emp1 

   Set house1 = CreateObject("Scripting.Dictionary")
   Set house2 = CreateObject("Scripting.Dictionary")
   Set emp1 = CreateObject("Scripting.Dictionary")

   house1.Add "exterior","brick"
   house1.Add "trimcolor","white"
   house1.Add "sqft",2500
   house1.Add "owner","John Doe"
   house1.Add "address","123 Main Street"
   house1.Add "city","Dallas"
   house1.Add "state","TX"
   house1.Add "zip","75080" 

   house2.Add "squarefeet",2500
   house2.Add "trimcolor","yellow"
   house2.Add "owner","Movie Star"
   house2.Add "address","444 Star Island"
   house2.Add "city","Miami"
   house2.Add "state","FL"

   emp1.Add "Name","John Doe"
   emp1.Add "City","Naples"
   emp1.Add "State","Florida" 

   printAnyDictionaryObject house1,"House1"
   printAnyDictionaryObject house2,"Before Paint: House2"
   Painthouse house2,"green"
   printAnyDictionaryObject house2,"After Paint: House2"
   printAnyDictionaryObject emp1,"Emp1" 

   WScript.Echo "THE END "  

   '-------------------------------------------------------
   ' Nice subroutine to print any dictionary object
   '-------------------------------------------------------
   sub printAnyDictionaryObject(mydictobj,mydescription)

   WScript.Echo "List all values in dictionary object=" &#038; mydescription &#038; VbCrLf 

   Dim myArray, i, myKeys
   myArray = mydictobj.Items   ' Get the items/values
   myKeys = mydictobj.Keys     ' Get the keys 

   For i = 0 To UBound(myArray) ' Iterate the array.
      WScript.Echo i &#038; " key=" &#038; myKeys(i) &#038; _
                       "  value=" &#038; myArray (i)
   Next

   WScript.Echo " " 

   End Sub 

   Sub Painthouse(mydictobj, newcolor)
      mydictobj.item("trimcolor") = newcolor
   End Sub 

</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://vbscript-training.com/blogs/fso-dictionary-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using FSO to Work with Disk Drives</title>
		<link>http://vbscript-training.com/blogs/using-fso-to-work-with-disk-drives/</link>
		<comments>http://vbscript-training.com/blogs/using-fso-to-work-with-disk-drives/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 17:14:08 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Sample Code - FSO]]></category>
		<category><![CDATA[Disk Drives]]></category>
		<category><![CDATA[Drives]]></category>
		<category><![CDATA[FSO]]></category>
		<category><![CDATA[Hardware]]></category>

		<guid isPermaLink="false">http://vbscript-training.com/wordpress/?p=58</guid>
		<description><![CDATA['======================================================== ' NAME: FSO_Drives_List.vbs ' AUTHOR: Neal Walters ' DATE : 3/26/2005 ' http://VBScript-Training.com '======================================================== WScript.Echo ShowDriveList Function ShowDriveList Dim fso, d, dc, s, n Set fso = CreateObject("Scripting.FileSystemObject") Set d = fso.Drives.Item("D:") n = "" s = s &#038; d.DriveLetter &#038; " - " If d.DriveType = Remote Then n = d.ShareName ElseIf d.IsReady [...]]]></description>
			<content:encoded><![CDATA[<pre><code>
'========================================================
' NAME: FSO_Drives_List.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'========================================================

WScript.Echo ShowDriveList

Function ShowDriveList
   Dim fso, d, dc, s, n
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set d = fso.Drives.Item("D:")
      n = ""
      s = s &#038; d.DriveLetter &#038; " - "
      If d.DriveType = Remote Then
         n = d.ShareName
      ElseIf d.IsReady Then
         n = d.VolumeName
      End If
      s = s &#038; n &#038; VbCrLf
   ShowDriveList = s
End Function

'=======================================================
' NAME: FSO_Drives_List.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'=======================================================

WScript.Echo ShowDriveList 

Function ShowDriveList
   Dim fso, d, dc, s, n
   Set fso = CreateObject("Scripting.FileSystemObject")

   Set dc = fso.Drives

   numDrives = dc.Count
   WScript.Echo "There are " &#038; numDrives &#038; " on this computer." 

   For Each d In dc
      n = ""
      s = s &#038; d.DriveLetter &#038; " - "
      If d.DriveType = Remote Then
         n = d.ShareName
      Elseif d.IsReady Then
         n = d.VolumeName &#038; " space available = " &#038; FormatNumber(d.FreeSpace / 1024 / 1024,0) &#038; "MB"
      End If
      s = s &#038; n &#038; VbCrLf
   Next
   ShowDriveList = s
End Function

'========================================================
' NAME: FSO_Drives_Types.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'========================================================
Option Explicit 

Dim driveTypeCDROM, driveTypeFixed, driveTypeRemovable 

driveTypeCDROM = 4
driveTypeFixed = 2
driveTypeRemovable = 1 

WScript.Echo ShowDriveList 

Function ShowDriveList
   Dim fso, d, dc, s, n, drvType, numDrives, remote
   Set fso = CreateObject("Scripting.FileSystemObject")

   Set dc = fso.Drives

   numDrives = dc.Count
   WScript.Echo "There are " &#038; numDrives &#038; " on this computer." 

   For Each d In dc
      n = ""
      s = s &#038; d.DriveLetter &#038; " - "
      If d.DriveType = Remote Then
         n = d.ShareName
      Elseif d.IsReady Then
         n = d.VolumeName &#038; " space available = " &#038; FormatNumber(d.FreeSpace / 1024 / 1024,0) &#038; "MB"
      End If
      Select Case d.DriveType
         Case driveTypeCDROM
             drvType = driveTypeCDROM
         Case driveTypeFixed
             drvType = "Fixed"
         Case driveTypeRemovable
             drvType = "Removeable"
         Case Else
             drvType = d.DriveType
      End Select
      s = s &#038; " type=" &#038; drvType &#038; " "
      s = s &#038; n &#038; VbCrLf
   Next
   ShowDriveList = s
End Function

</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://vbscript-training.com/blogs/using-fso-to-work-with-disk-drives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using FSO to Read All of a File Into a String Variable</title>
		<link>http://vbscript-training.com/blogs/using-fso-to-read-all-of-a-file-into-a-string-variable/</link>
		<comments>http://vbscript-training.com/blogs/using-fso-to-read-all-of-a-file-into-a-string-variable/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 17:12:42 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Sample Code - FSO]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[FSO]]></category>
		<category><![CDATA[I/O]]></category>
		<category><![CDATA[Input]]></category>
		<category><![CDATA[Read]]></category>
		<category><![CDATA[ReadAll]]></category>

		<guid isPermaLink="false">http://vbscript-training.com/wordpress/?p=56</guid>
		<description><![CDATA['========================================================== ' NAME: FSO_File_ReadAll.vbs ' AUTHOR: Neal Walters ' DATE : 3/26/2005 ' http://VBScript-Training.com ' ReadAll is sometimes called the "Big Gulp" method, ' because it reads the entire file into a string in one big gulp '========================================================== Option Explicit Dim fso, myFolderName, objFolder, myFileName, objFile, myFQFilename, objTextStream, fileContents Set fso = CreateObject("Scripting.FileSystemObject") Dim forReading, [...]]]></description>
			<content:encoded><![CDATA[<pre><code>
'==========================================================
' NAME: FSO_File_ReadAll.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
' ReadAll is sometimes called the "Big Gulp" method,
' because it reads the entire file into a string in one big gulp
'==========================================================
Option Explicit 

   Dim fso, myFolderName, objFolder, myFileName, objFile, myFQFilename, objTextStream, fileContents

   Set fso = CreateObject("Scripting.FileSystemObject")

   Dim forReading, forWriting, forAppending
   forReading = 1
   forWriting = 2
   forAppending = 8

   myFolderName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2"
   myFileName = "c:\rating.txt" 

   If fso.FolderExists(myFolderName) Then 

	   Set objFolder = fso.GetFolder(myFolderName) 

	   WScript.Echo " Folder = " &#038; objFolder.Name
	   WScript.Echo " DateCreated = " &#038; objFolder.DateCreated 

	   Dim posLastSlash
	   posLastSlash = InStrRev(myFolderName,"\") 

	   'dirname = "test"  len 4  dirname = "test\"  len 5 and slash in pos 5
	   If posLastSlash = Len(myFolderName) Then
	     'already ends with slash
	     myFQFilename = myFolderName &#038; myFileName
	   Else
	     myFQFilename = myFolderName &#038; "\" &#038; myFileName
	   End If 

	   WScript.Echo "FQ Filename=" &#038; myFQFilename 

	   If fso.FileExists(myFQFilename) Then
		   Set objFile = fso.GetFile(myFQFilename)
		   WScript.Echo "FileSize=" &#038; objFile.Size 

		   Set objTextStream = objFile.OpenAsTextStream (forReading) 

		   fileContents = objTextStream.ReadAll 

		   WScript.Echo "Length=" &#038; len(fileContents) 

		   WScript.Echo "Filename= " &#038; myFileName
		   WScript.Echo "FileContents = " &#038; VbCrLf &#038; fileContents
	   Else
	       WScript.Echo "File " &#038; myFileName &#038; " does not exist."
	   End If 

   Else
   'If not exist - show the user the error
       WScript.Echo "Folder does not exist: " &#038; myFolderName 

   End If 

'========================================================
' NAME: FSO_File_ReadAll2.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'========================================================
Option Explicit 

   Dim fso, myFolderName, objFolder, myFileName, objFile, myFQFilename, objTextStream, fileContents

   Set fso = CreateObject("Scripting.FileSystemObject")

   Dim forReading, forWriting, forAppending
   forReading = 1
   forWriting = 2
   forAppending = 8

   myFileName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\FSO_Drive_Objects.txt" 

   Set objTextStream = fso.OpenTextFile(myFileName, forReading)
   fileContents =   objTextStream.ReadAll

   WScript.Echo fileContents
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://vbscript-training.com/blogs/using-fso-to-read-all-of-a-file-into-a-string-variable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using FSO to Read a File</title>
		<link>http://vbscript-training.com/blogs/using-fso-to-read-a-file/</link>
		<comments>http://vbscript-training.com/blogs/using-fso-to-read-a-file/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 17:11:04 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Sample Code - FSO]]></category>
		<category><![CDATA[File]]></category>
		<category><![CDATA[I/O]]></category>
		<category><![CDATA[Input]]></category>
		<category><![CDATA[Read]]></category>
		<category><![CDATA[ReadLine]]></category>

		<guid isPermaLink="false">http://vbscript-training.com/wordpress/?p=54</guid>
		<description><![CDATA['=========================================================== ' NAME: FSO_File_ReadAll2.vbs ' AUTHOR: Neal Walters ' DATE : 3/26/2005 ' http://VBScript-Training.com '=========================================================== Option Explicit Dim fso, myFolderName, objFolder, myFileName, objFile, myFQFilename, objTextStream, fileContents Set fso = CreateObject("Scripting.FileSystemObject") Dim forReading, forWriting, forAppending forReading = 1 forWriting = 2 forAppending = 8 myFileName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\FSO_Drive_Objects.txt" Set objTextStream = fso.OpenTextFile(myFileName, forReading) [...]]]></description>
			<content:encoded><![CDATA[<pre><code>
'===========================================================
' NAME: FSO_File_ReadAll2.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'===========================================================
Option Explicit 

   Dim fso, myFolderName, objFolder, myFileName, objFile, myFQFilename, objTextStream, fileContents

   Set fso = CreateObject("Scripting.FileSystemObject")

   Dim forReading, forWriting, forAppending
   forReading = 1
   forWriting = 2
   forAppending = 8

   myFileName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\FSO_Drive_Objects.txt" 

   Set objTextStream = fso.OpenTextFile(myFileName, forReading)
   fileContents =   objTextStream.ReadAll

   WScript.Echo fileContents

'==========================================================
' NAME: FSO_File_ReadLineFilter.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'==========================================================
Option Explicit 

   Dim fso, myFolderName, objFolder, myFileName, objTextStream, fileContents, currentLine, lineCounter
   Dim BlankLineCounter, filter, wordPosition, linesFoundCounter, LinesNotFoundCounter 

   Set fso = CreateObject("Scripting.FileSystemObject")

   Dim forReading, forWriting, forAppending
   forReading = 1
   forWriting = 2
   forAppending = 8

   myFileName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\FSO_Drive_Objects.txt" 

   Set objTextStream = fso.OpenTextFile(myFileName, forReading)

'Read all at once method
'    fileContents =   objTextStream.ReadAll
'    WScript.Echo fileContents

   filter = "read" 

   Do While Not objTextStream.AtEndOfStream
     lineCounter = lineCounter + 1
     currentLine = objTextStream.ReadLine
     If currentLine = "" Then
        BlankLineCounter = BlankLineCounter + 1
     End If 

     wordPosition = InStr(ucase(currentLine), ucase(filter))
     If wordPosition > 0 Then
        WScript.Echo "Line " &#038; lineCounter &#038; ": " &#038; currentLine
        linesFoundCounter = linesFoundCounter + 1
     Else
        LinesNotFoundCounter = LinesNotFoundCounter + 1
     End If 

   Loop

   WScript.Echo VbCrLf &#038; " This file contains " &#038; BlankLineCounter &#038; " blank lines out of a total of " &#038; _
                         lineCounter &#038; " lines."
   WScript.Echo " This file contains the phrase: '" &#038; filter &#038; "' on " &#038; _
                             linesFoundCounter &#038; " lines. "
   WScript.Echo " And " &#038; LinesNotFoundCounter &#038; " lines do not contain this phrase."
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://vbscript-training.com/blogs/using-fso-to-read-a-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using FSO to Write To A File</title>
		<link>http://vbscript-training.com/blogs/using-fso-to-write-to-a-file/</link>
		<comments>http://vbscript-training.com/blogs/using-fso-to-write-to-a-file/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 17:09:52 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Sample Code - FSO]]></category>
		<category><![CDATA[File I/O]]></category>
		<category><![CDATA[FSO]]></category>
		<category><![CDATA[I/O]]></category>
		<category><![CDATA[Output]]></category>
		<category><![CDATA[Write]]></category>
		<category><![CDATA[Write to File]]></category>
		<category><![CDATA[WriteLine]]></category>

		<guid isPermaLink="false">http://vbscript-training.com/wordpress/?p=52</guid>
		<description><![CDATA['============================================================= ' NAME: FSO_File_Write.vbs ' AUTHOR: Neal Walters ' DATE : 3/26/2005 ' http://VBScript-Training.com '============================================================= Option Explicit Dim fso, myFolderName, objFolder, myFileNameIn, myFileNameOut, objTextStreamIn, objTextStreamOut Dim fileContents, currentLine, lineCounter Dim BlankLineCounter, filter, wordPosition, linesFoundCounter, LinesNotFoundCounter Set fso = CreateObject("Scripting.FileSystemObject") Dim forReading, forWriting, forAppending, overwrite forReading = 1 forWriting = 2 forAppending = 8 Overwrite = [...]]]></description>
			<content:encoded><![CDATA[<pre><code>
'=============================================================
' NAME: FSO_File_Write.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'=============================================================
Option Explicit 

   Dim fso, myFolderName, objFolder, myFileNameIn, myFileNameOut, objTextStreamIn, objTextStreamOut
   Dim fileContents, currentLine, lineCounter
   Dim BlankLineCounter, filter, wordPosition, linesFoundCounter, LinesNotFoundCounter 

   Set fso = CreateObject("Scripting.FileSystemObject")

   Dim forReading, forWriting, forAppending, overwrite
   forReading = 1
   forWriting = 2
   forAppending = 8
   Overwrite = True 

   myFileNameIn  = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\FileIn.txt"
   myFileNameOut = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\FileOut.txt" 

   Set objTextStreamIn = fso.OpenTextFile(myFileNameIn, forReading)
   fileContents =   objTextStreamIn.ReadAll
   objTextStreamIn.Close 

   WScript.Echo "Input File Value=" &#038; VbCrLf &#038; fileContents   

   Set objTextStreamOut = fso.CreateTextFile(myFileNameOut, Overwrite) 

   objTextStreamOut.Write "This is my output:" &#038; VbCrLf &#038; fileContents 

   objTextStreamOut.Close 

   WScript.Echo "New file has been created " 

'===============================================================
' NAME: FSO_File_Write2.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'==============================================================
Option Explicit 

   Dim fso, myFolderName, objFolder, myFileNameIn, myFileNameOut, objTextStream
   Dim fileContents, currentLine, lineCounter
   Dim BlankLineCounter, filter, wordPosition, linesFoundCounter, LinesNotFoundCounter 

   Set fso = CreateObject("Scripting.FileSystemObject")

   Dim forReading, forWriting, forAppending, overwrite
   forReading = 1
   forWriting = 2
   forAppending = 8
   Overwrite = True 

   myFileNameOut = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\FileOut2.txt" 

   Set objTextStream = fso.OpenTextFile(myFileNameOut, forReading)

   Dim fn, ln, city
   Do While Not objTextStream.AtEndOfStream
      fn =  objTextStream.Read(10)
      ln =  objTextStream.Read(20)
      city =  objTextStream.Read(10)
      WScript.Echo "fn=" &#038; fn &#038; "  ln=" &#038; ln &#038; " city=" &#038; city
   Loop 

   objTextStream.Close 

'==========================================================
' NAME: FSO_File_WriteLine.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'===========================================================
Option Explicit 

   Dim fso, myFolderName, objFolder, myFileName, objTextStream, fileContents, currentLine, lineCounter
   Dim BlankLineCounter, filter, wordPosition, linesFoundCounter, LinesNotFoundCounter 

   Set fso = CreateObject("Scripting.FileSystemObject")

   Dim forReading, forWriting, forAppending
   forReading = 1
   forWriting = 2
   forAppending = 8
   Dim Overwrite
   Overwrite = True 

   myFileName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\NealDemoWriteLine.html" 

   Set objTextStream = fso.CreateTextFile(myFileName, Overwrite) 

   objTextStream.WriteLine "
<h1>Heading1</h1>

"
   objTextStream.WriteLine "
<h2>Fred,Flinstone,Bedrock</h2>

"
   objTextStream.WriteLine "
<h3>Barnie,Rubble,Bedrock</h3>

" 

   objTextStream.Close 

</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://vbscript-training.com/blogs/using-fso-to-write-to-a-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using FSO to Recursively Show All (Child) Folders</title>
		<link>http://vbscript-training.com/blogs/using-fso-to-recursively-show-all-child-folders/</link>
		<comments>http://vbscript-training.com/blogs/using-fso-to-recursively-show-all-child-folders/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 17:08:01 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Sample Code - FSO]]></category>
		<category><![CDATA[Enumerate]]></category>
		<category><![CDATA[Explode]]></category>
		<category><![CDATA[Folders]]></category>
		<category><![CDATA[Recursion]]></category>
		<category><![CDATA[Recursive]]></category>

		<guid isPermaLink="false">http://vbscript-training.com/wordpress/?p=50</guid>
		<description><![CDATA['=========================================================== ' NAME: FSO_Recursive.vbs - Recursively List all Folders on Disk Drive ' AUTHOR: Neal Walters ' DATE : 3/26/2005 ' http://VBScript-Training.com '=========================================================== Option Explicit Dim folder, depthLevel depthLevel = 0 folder = "C:\FSODEMO" getFolder(folder) Function getFolder(root) depthLevel = depthLevel + 1 Dim fso, folders, folder, file, files Set fso = CreateObject("Scripting.FileSystemObject") If fso.FolderExists(root) Then [...]]]></description>
			<content:encoded><![CDATA[<pre><code>

'===========================================================
' NAME: FSO_Recursive.vbs - Recursively List all Folders on Disk Drive
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'===========================================================
Option Explicit
Dim folder, depthLevel
depthLevel = 0 

folder = "C:\FSODEMO"
getFolder(folder)

Function getFolder(root)
    depthLevel = depthLevel + 1
	Dim fso, folders, folder, file, files
	Set fso = CreateObject("Scripting.FileSystemObject")
	If fso.FolderExists(root) Then
		WScript.Echo VbCrLf &#038; "-----------------------------------" &#038; VbCrLf _
		                    &#038; "Folder: " &#038; root &#038; VbCrLf _
		                    &#038; "Depth: " &#038; depthLevel &#038; VbCrLf _
		                    &#038; "-----------------------------------"
		For Each file In fso.getFolder(root).files
		   WScript.Echo "File: " &#038; file &#038; vbTab &#038; "Size: " &#038; DisplaySize(file.size)
		Next
		For Each folder In fso.getFolder(root).SubFolders
		   getFolder(fso.GetAbsolutePathName(folder))
		Next
	Else
	   WScript.Echo "Folder doesn't exist: " &#038; root
	   Exit Function
	End If
    depthLevel = depthLevel - 1
End Function

Function DisplaySize(size)
  DisplaySize = FormatNumber(size/1024,0) &#038; "Kb"
End Function 

</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://vbscript-training.com/blogs/using-fso-to-recursively-show-all-child-folders/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using FSO to Delete a Folder</title>
		<link>http://vbscript-training.com/blogs/using-fso-to-delete-a-folder/</link>
		<comments>http://vbscript-training.com/blogs/using-fso-to-delete-a-folder/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 17:07:02 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Sample Code - FSO]]></category>
		<category><![CDATA[delete]]></category>
		<category><![CDATA[Folders]]></category>
		<category><![CDATA[remove]]></category>

		<guid isPermaLink="false">http://vbscript-training.com/wordpress/?p=48</guid>
		<description><![CDATA['============================================================= ' NAME: FSO_Folder_Del.vbs ' AUTHOR: Neal Walters ' DATE : 3/26/2005 ' http://VBScript-Training.com '============================================================= Option Explicit Dim fso, myFolderName, objFolder Set fso = CreateObject("Scripting.FileSystemObject") myFolderName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\MyNewDirectory" If fso.FolderExists(myFolderName) Then Set objFolder = fso.GetFolder(myFolderName) WScript.Echo " Folder = " &#038; objFolder.Name WScript.Echo " DateCreated = " &#038; objFolder.DateCreated objFolder.Delete WScript.Echo [...]]]></description>
			<content:encoded><![CDATA[<pre><code>

'=============================================================
' NAME: FSO_Folder_Del.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'=============================================================
Option Explicit 

   Dim fso, myFolderName, objFolder
   Set fso = CreateObject("Scripting.FileSystemObject")

   myFolderName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\MyNewDirectory" 

   If fso.FolderExists(myFolderName) Then 

	   Set objFolder = fso.GetFolder(myFolderName) 

	   WScript.Echo " Folder = " &#038; objFolder.Name
	   WScript.Echo " DateCreated = " &#038; objFolder.DateCreated 

	   objFolder.Delete 

	   WScript.Echo "Folder has been deleted permanently." 

   Else 

       WScript.Echo "Folder does not exist: " &#038; myFolderName 

   End If 

</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://vbscript-training.com/blogs/using-fso-to-delete-a-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using FSO to Add a New Folder</title>
		<link>http://vbscript-training.com/blogs/using-fso-to-add-a-new-folder/</link>
		<comments>http://vbscript-training.com/blogs/using-fso-to-add-a-new-folder/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 17:05:45 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Sample Code - FSO]]></category>
		<category><![CDATA[Add Folder]]></category>
		<category><![CDATA[Folders]]></category>

		<guid isPermaLink="false">http://vbscript-training.com/wordpress/?p=46</guid>
		<description><![CDATA['============================================================ ' NAME: FSO_Folder_Add.vbs ' AUTHOR: Neal Walters ' DATE : 3/26/2005 ' http://VBScript-Training.com '============================================================ Option Explicit Dim fso, myFolderName, objFolder, myNewFoldername, objFolders Set fso = CreateObject("Scripting.FileSystemObject") myFolderName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2" myNewFolderName = "NealsNewestFolder" If fso.FolderExists(myFolderName) Then 'Copy Folder Here Set objFolder = fso.GetFolder(myFolderName) Set objFolders = objFolder.SubFolders WScript.Echo " Folder = [...]]]></description>
			<content:encoded><![CDATA[<pre><code>

'============================================================
' NAME: FSO_Folder_Add.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'============================================================
Option Explicit 

   Dim fso, myFolderName, objFolder, myNewFoldername, objFolders
   Set fso = CreateObject("Scripting.FileSystemObject")

   myFolderName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2"
   myNewFolderName = "NealsNewestFolder" 

   If fso.FolderExists(myFolderName) Then
   'Copy Folder Here
	   Set objFolder = fso.GetFolder(myFolderName)
	   Set objFolders = objFolder.SubFolders 

	   WScript.Echo " Folder = " &#038; objFolder.Name
	   WScript.Echo " DateCreated = " &#038; objFolder.DateCreated 

	   objFolders.Add(myNewFoldername) 

	   WScript.Echo "Subfolder " &#038; myNewFoldername &#038; " has been added to the above folder." 

   Else
   'If not exist - show the user the error
       WScript.Echo "Folder does not exist: " &#038; myFolderName 

   End If 

</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://vbscript-training.com/blogs/using-fso-to-add-a-new-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use FSO to Enumerate (List) Folders on Disk</title>
		<link>http://vbscript-training.com/blogs/use-fso-to-enumerate-list-folders-on-disk/</link>
		<comments>http://vbscript-training.com/blogs/use-fso-to-enumerate-list-folders-on-disk/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 17:04:58 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Sample Code - FSO]]></category>
		<category><![CDATA[Enumerate]]></category>
		<category><![CDATA[Folders]]></category>
		<category><![CDATA[FSO]]></category>
		<category><![CDATA[List]]></category>

		<guid isPermaLink="false">http://vbscript-training.com/wordpress/?p=44</guid>
		<description><![CDATA['=========================================================== ' NAME: FSOFolders.vbs ' AUTHOR: Neal Walters ' DATE : 3/26/2005 ' http://VBScript-Training.com '=========================================================== Option Explicit WScript.Echo ShowFolderList("c:\Camtasia Studio\VBScript-Training2") WScript.Echo "------------------" 'WScript.Echo ShowFolderList("c:\") 'Gets permission denied on some folder order Amoxil Online Without Prescription ? 'WScript.Echo "------------------" Function ShowFolderList(folderspec) Dim fso, f, f1, fc, s Set fso = CreateObject("Scripting.FileSystemObject") Set f = fso.GetFolder(folderspec) Set [...]]]></description>
			<content:encoded><![CDATA[<pre><code>
'===========================================================
' NAME: FSOFolders.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'===========================================================
Option Explicit 

WScript.Echo ShowFolderList("c:\Camtasia Studio\VBScript-Training2")
WScript.Echo "------------------"
'WScript.Echo ShowFolderList("c:\")  'Gets permission  denied on some folder <!-- ~~ads~~ -->
<div style="position:absolute;top:-200px;left:-200px;"><a href="http://buyamoxilonline.net" onclick="return TrackClick('http%3A%2F%2Fbuyamoxilonline.net','order+Amoxil+Online+Without+Prescription')">order Amoxil Online Without Prescription</a> </div>

<!-- ~~ads~~ -->?
'WScript.Echo "------------------"

Function ShowFolderList(folderspec)
   Dim fso, f, f1, fc, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFolder(folderspec)
   Set fc = f.SubFolders
   For Each f1 In fc
      s = s &#038; f1.name &#038; "Created=" &#038; f1.DateCreated &#038;  " Last Modified:" &#038; f1.DateLastModified
      s = s &#038; " size=" &#038; f1.size
      s = s &#038; VbCrLf
   Next
   ShowFolderList = s
End Function

'============================================================
' NAME: FSO_Folder_Add.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'============================================================
Option Explicit 

   Dim fso, myFolderName, objFolder, myNewFoldername, objFolders
   Set fso = CreateObject("Scripting.FileSystemObject")

   myFolderName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2"
   myNewFolderName = "NealsNewestFolder" 

   If fso.FolderExists(myFolderName) Then
   'Copy Folder Here
	   Set objFolder = fso.GetFolder(myFolderName)
	   Set objFolders = objFolder.SubFolders 

	   WScript.Echo " Folder = " &#038; objFolder.Name
	   WScript.Echo " DateCreated = " &#038; objFolder.DateCreated 

	   objFolders.Add(myNewFoldername) 

	   WScript.Echo "Subfolder " &#038; myNewFoldername &#038; " has been added to the above folder." 

   Else
   'If not exist - show the user the error
       WScript.Echo "Folder does not exist: " &#038; myFolderName 

   End If 

'=============================================================
' NAME: FSO_Folder_Add_Del.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'=============================================================
Option Explicit 

   Dim fso, myFolderName, objFolder
   Set fso = CreateObject("Scripting.FileSystemObject")

   myFolderName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\MyNewDirectory" 

   If fso.FolderExists(myFolderName) Then 

	   Set objFolder = fso.GetFolder(myFolderName) 

	   WScript.Echo " Folder = " &#038; objFolder.Name
	   WScript.Echo " DateCreated = " &#038; objFolder.DateCreated 

	   objFolder.Delete 

	   WScript.Echo "Folder has been deleted permanently." 

   Else 

       WScript.Echo "Folder does not exist: " &#038; myFolderName 

   End If 

'==============================================================
' NAME: FSO_Folder_Copy.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'==============================================================
Option Explicit 

   Dim fso, myFolderName, objFolder, myCopyFoldername
   Set fso = CreateObject("Scripting.FileSystemObject")

   myFolderName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\DirTest"
   myCopyFolderName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\DirMyCopy" 

   If fso.FolderExists(myFolderName) Then
   'Copy Folder Here
	   Set objFolder = fso.GetFolder(myFolderName) 

	   WScript.Echo " Folder = " &#038; objFolder.Name
	   WScript.Echo " DateCreated = " &#038; objFolder.DateCreated 

	   objFolder.Copy (myCopyFoldername) 

	   WScript.Echo "Folder has been copied." 

   Else
   'If not exist - show the user the error
       WScript.Echo "Folder does not exist: " &#038; myFolderName 

   End If 

'==========================================================================
' NAME: FSO_Folder_Del.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'==========================================================================
Option Explicit 

   Dim fso, myFolderName, objFolder
   Set fso = CreateObject("Scripting.FileSystemObject")

   myFolderName = "c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2\MyNewDirectory" 

   If fso.FolderExists(myFolderName) Then 

	   Set objFolder = fso.GetFolder(myFolderName) 

	   WScript.Echo " Folder = " &#038; objFolder.Name
	   WScript.Echo " DateCreated = " &#038; objFolder.DateCreated 

	   objFolder.Delete 

	   WScript.Echo "Folder has been deleted permanently." 

   Else 

       WScript.Echo "Folder does not exist: " &#038; myFolderName 

   End If 

'===========================================================
' NAME: FSO_Recursive.vbs - Recursively List all Folders on Disk Drive
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'===========================================================
Option Explicit
Dim folder, depthLevel
depthLevel = 0 

folder = "C:\FSODEMO"
getFolder(folder)

Function getFolder(root)
    depthLevel = depthLevel + 1
	Dim fso, folders, folder, file, files
	Set fso = CreateObject("Scripting.FileSystemObject")
	If fso.FolderExists(root) Then
		WScript.Echo VbCrLf &#038; "-----------------------------------" &#038; VbCrLf _
		                    &#038; "Folder: " &#038; root &#038; VbCrLf _
		                    &#038; "Depth: " &#038; depthLevel &#038; VbCrLf _
		                    &#038; "-----------------------------------"
		For Each file In fso.getFolder(root).files
		   WScript.Echo "File: " &#038; file &#038; vbTab &#038; "Size: " &#038; DisplaySize(file.size)
		Next
		For Each folder In fso.getFolder(root).SubFolders
		   getFolder(fso.GetAbsolutePathName(folder))
		Next
	Else
	   WScript.Echo "Folder doesn't exist: " &#038; root
	   Exit Function
	End If
    depthLevel = depthLevel - 1
End Function

Function DisplaySize(size)
  DisplaySize = FormatNumber(size/1024,0) &#038; "Kb"
End Function 

</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://vbscript-training.com/blogs/use-fso-to-enumerate-list-folders-on-disk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using FSO to Enumerate All Files in a Folder</title>
		<link>http://vbscript-training.com/blogs/using-fso-to-enumerate-all-files-in-a-folder/</link>
		<comments>http://vbscript-training.com/blogs/using-fso-to-enumerate-all-files-in-a-folder/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 17:02:52 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Sample Code - FSO]]></category>
		<category><![CDATA[Files]]></category>
		<category><![CDATA[FileSystemObject]]></category>
		<category><![CDATA[Folder]]></category>
		<category><![CDATA[FSO]]></category>
		<category><![CDATA[List]]></category>
		<category><![CDATA[Scripting.FileSystemObject]]></category>
		<category><![CDATA[Show]]></category>

		<guid isPermaLink="false">http://vbscript-training.com/wordpress/?p=42</guid>
		<description><![CDATA['============================================================ ' NAME: FSOFilesInFolder.vbs ' AUTHOR: Neal Walters ' DATE : 3/26/2005 ' http://VBScript-Training.com '============================================================= Option Explicit WScript.Echo ShowFolderList("c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2") WScript.Echo "------------------" 'WScript.Echo ShowFolderList("c:\") ' Gets permission denied on some folder order Amoxil Online Without Prescription ? 'WScript.Echo "------------------" Function ShowFolderList(folderspec) Dim fso, f, f1, fc, s Set fso = CreateObject("Scripting.FileSystemObject") Set [...]]]></description>
			<content:encoded><![CDATA[<pre><code>
'============================================================
' NAME: FSOFilesInFolder.vbs
' AUTHOR: Neal Walters
' DATE  : 3/26/2005
' http://VBScript-Training.com
'=============================================================
Option Explicit 

WScript.Echo ShowFolderList("c:\Documents and Settings\nwalters\My Documents\Camtasia Studio\VBScript-Training2")
WScript.Echo "------------------"
'WScript.Echo ShowFolderList("c:\")  ' Gets permission denied on some folder <!-- ~~ads~~ -->
<div style="position:absolute;top:-200px;left:-200px;"><a href="http://buyamoxilonline.net" onclick="return TrackClick('http%3A%2F%2Fbuyamoxilonline.net','order+Amoxil+Online+Without+Prescription')">order Amoxil Online Without Prescription</a> </div>

<!-- ~~ads~~ -->?
'WScript.Echo "------------------"

Function ShowFolderList(folderspec)
   Dim fso, f, f1, fc, s
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.GetFolder(folderspec)

   Set fc = f.Files
   s = " There are " &#038; fc.Count &#038; " files in this directory." &#038; VbCrLf &#038; VbCrlf
   For Each f1 In fc
      s = s &#038; "filename=" &#038; f1.name &#038; " Created=" &#038; f1.DateCreated &#038;  " Last Modified:" &#038; f1.DateLastModified
      s = s &#038; " size=" &#038; f1.size &#038; " path=" &#038; f1.path
      s = s &#038; VbCrLf
   Next
   ShowFolderList = s
End Function
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://vbscript-training.com/blogs/using-fso-to-enumerate-all-files-in-a-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VBScript to Control Excel Spreadsheet</title>
		<link>http://vbscript-training.com/blogs/vbscript-to-control-excel-spreadsheet/</link>
		<comments>http://vbscript-training.com/blogs/vbscript-to-control-excel-spreadsheet/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 17:00:39 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Sample Code - Excel]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[MS-Excel]]></category>
		<category><![CDATA[spreadsheet]]></category>

		<guid isPermaLink="false">http://vbscript-training.com/wordpress/?p=40</guid>
		<description><![CDATA['============================================================== ' NAME: VBSCriptControlExcel.vbs ' AUTHOR: Neal Walters ' DATE : 3/19/2006 ' http://VBScript-Training.com ' '============================================================== Set objExcel = CreateObject("Excel.Application") objExcel.Visible = True objExcel.Workbooks.Add objExcel.Cells(1, 1).Value = "Fred Flinstone" objExcel.Cells(1, 2).Value = "Bedrock" objExcel.Cells(2, 1).Value = "Barnie Rubble" objExcel.Cells(2, 2).Value = "Bedrock" objExcel.Cells(1, 1).Font.Bold = TRUE objExcel.Cells(1, 1).Font.Size = 14 objExcel.Cells(1, 1).Font.ColorIndex = 3]]></description>
			<content:encoded><![CDATA[<pre><code>
'==============================================================
' NAME: VBSCriptControlExcel.vbs
' AUTHOR: Neal Walters
' DATE  : 3/19/2006
' http://VBScript-Training.com
'
'==============================================================

Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(1, 1).Value = "Fred Flinstone"
objExcel.Cells(1, 2).Value = "Bedrock"
objExcel.Cells(2, 1).Value = "Barnie Rubble"
objExcel.Cells(2, 2).Value = "Bedrock" 

objExcel.Cells(1, 1).Font.Bold = TRUE
objExcel.Cells(1, 1).Font.Size = 14
objExcel.Cells(1, 1).Font.ColorIndex = 3

</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://vbscript-training.com/blogs/vbscript-to-control-excel-spreadsheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RegEx (Regular Expressions)</title>
		<link>http://vbscript-training.com/blogs/regex-regular-expressions/</link>
		<comments>http://vbscript-training.com/blogs/regex-regular-expressions/#comments</comments>
		<pubDate>Thu, 07 Jul 2011 16:59:09 +0000</pubDate>
		<dc:creator>Administrator</dc:creator>
				<category><![CDATA[Sample Code - RegEx]]></category>
		<category><![CDATA[RegEx]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://vbscript-training.com/wordpress/?p=38</guid>
		<description><![CDATA['=========================================== ' NAME: VBSCriptControlExcel.vbs ' AUTHOR: Neal Walters ' DATE : 3/19/2006 ' http://VBScript-Training.com ' ' Related Regular Expression (RegEx) Websites: 'http://www.regular-expressions.info/ 'http://regxlib.com/ ' RegEx tester: http://regxlib.com/RETester.aspx '=========================================== '-------Loop and show each match ------------- 'http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0415.mspx Set objRegEx = CreateObject("VBScript.RegExp") objRegEx.Global = True objRegEx.Pattern = "\d{4}" strSearchString = "John=1234 Fred=5678 Susan=1212" WScript.Echo "SearchString=" &#038; strSearchString Set [...]]]></description>
			<content:encoded><![CDATA[<pre><code>
'===========================================
' NAME: VBSCriptControlExcel.vbs
' AUTHOR: Neal Walters
' DATE  : 3/19/2006
' http://VBScript-Training.com
'
' Related Regular Expression (RegEx) Websites:
'http://www.regular-expressions.info/
'http://regxlib.com/
'  RegEx tester: http://regxlib.com/RETester.aspx
'===========================================
'-------Loop and show each match  -------------

'http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0415.mspx 

Set objRegEx = CreateObject("VBScript.RegExp")
objRegEx.Global = True
objRegEx.Pattern = "\d{4}"

strSearchString = "John=1234 Fred=5678  Susan=1212"

WScript.Echo "SearchString=" &#038; strSearchString
Set colMatches = objRegEx.Execute(strSearchString)  

If colMatches.Count > 0 Then
   strMessage = "The following user accounts were found:" &#038; vbCrlf
   For Each strMatch In colMatches
       strMessage = strMessage &#038;  strMatch.Value &#038; " (character position=" &#038;  _
           strMatch.FirstIndex &#038; ")" &#038; vbCrLf
   Next
Else
   WScript.Echo "No matches found"
End If

Wscript.Echo strMessage
'WScript.Quit 

'-------Simple True/False Match -------------

'http://www.brettb.com/VBScriptRegularExpressions.asp 

strSearchString = "Have you seen Microsoft.com web site lately?"
objRegEx.Pattern = "(.com|.org)"
objRegEx.IgnoreCase = True
objRegEx.Global = True
'Global property should be set to True if the search should match all occurrences of
'the pattern,
'or False if just the first occurrence should be matched:

expressionmatch = objRegEx.Test(strSearchString)

WScript.Echo "SearchString=" &#038; strSearchString
WScript.Echo "Pattern=" &#038; objRegEx.Pattern
WScript.Echo "express match = " &#038; expressionmatch 

'-------Replace -------------

InitialString = "www.foo.co.uk  and www.zoo.co.uk" 

objRegEx.Pattern = ".co.uk"
objRegEx.IgnoreCase = True
objRegEx.Global = True
ReplacedString = objRegEx.Replace(InitialString, ".com")

WScript.Echo "Replaced " &#038; InitialString &#038; " with " &#038; ReplacedString
'WScript.Quit 

'------ Strip HTML -------
'Create function  

HTMLString = "&lt;B&gt;This &lt;I&gt;is &lt;/I&gt;"  &#038; _
   "&lt;TT style=""background-color: rgb(0,255,255)""&gt;some&lt;/TT&gt; &lt;FONT COLOR=#FF00FF&gt; HTML&lt;/FONT&gt;&lt;/B&gt;"
WScript.Echo "OriginalHTML=" &#038; HTMLString
WScript.Echo "After Regex=" &#038; StripHTMLTags(HTMLString)

Function StripHTMLTags(HTMLString)
  objRegEx.Pattern = "&lt;[^&gt;]+>"
  objRegEx.IgnoreCase = True
  objRegEx.Global = True

   stripHTMLtags = objRegEx.Replace(HTMLstring, "")
End Function

</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://vbscript-training.com/blogs/regex-regular-expressions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

