Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
========================================================
' Declare variables
'========================================================
Option Explicit
Dim fso, objExcel, objWorkbook, nRow, nCol, TotalCellLen, BegPos, EndPos, x
Dim InputFileName, OutputFileName
'========================================================
' Initializes FSO
'========================================================
Set fso = CreateObject("Scripting.FileSystemObject")
'========================================================
' Error checking for Input and Output files
'========================================================
Do
InputFileName = Inputbox("Please enter your Input Excel File Name!","Enter Input Excel File Name")
If fso.FileExists(InputFileName) = False then
MsgBox "Please enter a valid Input File Name!", vbCritical
InputFilename = ""
End If
Loop Until Len(InputFilename) > 0
Do
OutputFileName = InputBox("Please enter your Output Excel File Name!","Enter Output Excel File Name")
Loop Until Len(OutputFileName) > 0
'==============================================================
' Initializes Variables and checks to see if output file exists
'==============================================================
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Open(InputFileName)
If fso.FileExists(OutputFileName) Then fso.DeleteFile(OutputFileName)
nRow = 1
nCol = 1
TotalCellLen = 0
BegPos = 0
EndPos = 0
'=================================================================
' Loops through the entire Excel file flagging fields in red
'=================================================================
Do Until Len(Trim(objExcel.Cells(nRow, nCol).Value)) = 0
TotalCellLen = Len(objExcel.Cells(nRow, nCol).Value)
For x = 1 To TotalCellLen
If Mid(objExcel.Cells(nRow, nCol).Value, x, 1) = "<" Then
BegPos = x
ElseIf Mid(objExcel.Cells(nRow, nCol).Value, x, 1) = ">" Then
EndPos = x + 1
objExcel.Cells(nRow, nCol).Characters(BegPos, TotalCellLen - EndPos).Font.Color = vbRed
Else
objExcel.Cells(nRow, nCol).Characters(x, x).Font.Color = vbBlack
End If
Next
nRow = nRow + 1
Loop
'========================================================
' Closes and clears all objects from memory
'========================================================
objWorkbook.SaveAs (OutputFileName)
objWorkbook.Close
objExcel.Application.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing
Set fso = Nothing
'========================================================
' Prompts the user of completion
'========================================================
MsgBox "Done!"
'========================================================
' Declare variables
'========================================================
Option Explicit
Dim fso, objExcel, objWorkbook, nRow, nCol, BegPos, EndPos, x
Dim InputFileName, OutputFileName
'========================================================
' Initializes FSO
'========================================================
Set fso = CreateObject("Scripting.FileSystemObject")
'========================================================
' Error checking for Input and Output files
'========================================================
Do
InputFileName = Inputbox("Please enter your Input Excel File Name!","Enter Input Excel File Name")
If fso.FileExists(InputFileName) = False then
MsgBox "Please enter a valid Input File Name!", vbCritical
InputFilename = ""
End If
Loop Until Len(InputFilename) > 0
Do
OutputFileName = InputBox("Please enter your Output Excel File Name!","Enter Output Excel File Name")
Loop Until Len(OutputFileName) > 0
'==============================================================
' Initializes Variables and checks to see if output file exists
'==============================================================
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
Set objWorkbook = objExcel.Workbooks.Open(InputFileName)
If fso.FileExists(OutputFileName) Then fso.DeleteFile(OutputFileName)
nRow = 0
nCol = 0
BegPos = 0
EndPos = 0
'=================================================================
' Loops through the entire Excel file flagging fields in red
'=================================================================
For nRow = 1 To 100
For nCol = 1 To 26
For x = 1 To Len(objExcel.Cells(nRow, nCol).Value)
If Mid(objExcel.Cells(nRow, nCol).Value, x, 1) = "<" Then
BegPos = x
ElseIf Mid(objExcel.Cells(nRow, nCol).Value, x, 1) = ">" Then
EndPos = (x - BegPos) + 1
objExcel.Cells(nRow, nCol).Characters(BegPos, EndPos).Font.Color = vbRed
Else
objExcel.Cells(nRow, nCol).Characters(x, 1).Font.Color = vbBlack
End If
Next
Next
Next
'========================================================
' Closes and clears all objects from memory
'========================================================
objWorkbook.SaveAs (OutputFileName)
objWorkbook.Close
objExcel.Application.Quit
Set objWorkbook = Nothing
Set objExcel = Nothing
Set fso = Nothing
'========================================================
' Prompts the user of completion
'========================================================
MsgBox "Done!"