This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub ListFilesInDirectory() | |
Dim fsFile, sFilename, sPath As String | |
Dim i As Integer | |
i = 2 | |
'Set file attributes | |
sPath = "C:\" | |
sFilename = "*.pdf" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Global Error Varibles | |
Public bDisplayError As Boolean | |
Public sProcName, sDetails As String | |
Public iErrorCount As Integer | |
Public Function bCentralErrorHandler(ByVal sModule$, ByVal sSub$, ByVal sDetails$) As Boolean | |
'Make sure there is no errors in the Error Handling system | |
On Error Resume Next |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'Note: needs to be attached to a worksheet | |
Private Sub Worksheet_Change(ByVal Target As Range) | |
'Specifies the target column to pay attention to on worksheet change | |
If (Target.Column = 2) Then | |
'Conditional statement based on cell value | |
Select Case Target.Value | |
Case "red" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub CreateHTMLMsg() | |
Dim sLocation As String | |
'Change this to the location of your HTML file | |
sLocation = "C:\HTML_Template.html" | |
Set objMsg = Application.CreateItem(olMailItem) | |
Set fso = CreateObject("Scripting.FileSystemObject") | |
Set ts = fso.OpenTextFile(sLocation, 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Protected Sub FormToXML (ByVal sender As Object, ByVal e As System.EventArgs) | |
// Create the XML document object with specified parametres | |
Dim XMLDoc As XDocument | |
XMLDoc = New XDocument( | |
New XDeclaration("1.0", "utf-8", "yes"), | |
New XElement("user", | |
New XElement("details", | |
New XElement("firstname", Firstname.Text), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function CountWordsOccurrence() As Integer | |
Application.ScreenUpdating = False | |
Dim sWords As String | |
Dim iCount As Integer | |
'The word which is being counted | |
sWords = "word" | |
NewerOlder