Category: VBScript

  • Track your unread items/total items count in Outlook on startup.

    I added this to my Outlook macros [started with code for displaying all unread messages]. After selecting Alt-F11 and ThisOutlookSession [on the left sidebar], I selected “Application” and “Startup” [which is where this code is added.] It append to a .csv file that can be opened in Excel. This is nice if you’re attempting to […]

  • VBScript to push files into an array based on a wildcard

    Option ExplicitDim gFSODim dirListingDim fileNameset gFSO = CreateObject("Scripting.FileSystemObject")dirListing = ListDir("c:??*d*")If UBound(dirListing) = -1 then Wscript.Echo "No files found."Else For Each fileName in dirListing WScript.Echo FileName NextEnd If’==============================================================================’ List a directory, with the last part of the directory being the path’==============================================================================Function ListDir (ByVal Path) Dim fileRegex Dim searchFolderName Dim searchFolder Dim searchFolderFiles Dim fileName Dim fileArray […]

  • VBScript to convert timestamp to YYYYMMDD formatted string

    I started with the code on this page. Function FormatYYYYMMDD(timeStamp) Dim dateMonth : dateMonth = DatePart("M", timeStamp) Dim dateDay : dateDay = DatePart("D", timeStamp) Dim dateYear : dateYear = DatePart("YYYY", timeStamp) Dim dateString dateString = dateYear If dateMonth < 10 Then dateString = dateString & "0" & dateMonth Else dateString = dateString & dateMonth End […]