picklefactory
Well-known Member
- Joined
- Jan 28, 2005
- Messages
- 508
- Office Version
- 365
- Platform
- Windows
Hi folks
I have a simple UDF just to compare text files and highlight any lines between the two that do not match, it simply runs the basic DOS file compare function but just simplifies the usage. Just had my work pc upgraded to Win 10 (Yep... just), and now find that this doesn't work any more, and I don't know if it's
a/ Win 10 doesn't support this function anymore or
b/ The code just needs updating to suit.
Would anyone have an inkling at all please?
Thanks
I have a simple UDF just to compare text files and highlight any lines between the two that do not match, it simply runs the basic DOS file compare function but just simplifies the usage. Just had my work pc upgraded to Win 10 (Yep... just), and now find that this doesn't work any more, and I don't know if it's
a/ Win 10 doesn't support this function anymore or
b/ The code just needs updating to suit.
Would anyone have an inkling at all please?
Thanks
Code:
Sub CompareFiles()
' Sub to run DOS File Compare function without all the typing
Dim varFile1, varFile2, varFile3 ' Set variable names
varFile1 = Application.GetOpenFilename("All Files (*.*), *.*", , _
"Select first comparison file") ' Open Explorer window to select 1st program to compare
If TypeName(varFile1) = "Boolean" Then Exit Sub
varFile2 = Application.GetOpenFilename("All Files (*.*), *.*", , _
"Select second comparison file") ' Open Explorer window to select 2nd program to compare
If TypeName(varFile2) = "Boolean" Then Exit Sub
varFile3 = Application.GetSaveAsFilename(Title:="Specify output file name") ' Open Explorer window to designate path and file name
'for resulting comparison file
If TypeName(varFile3) = "Boolean" Then Exit Sub
Shell "cmd.exe /c ""fc /n """ & varFile1 & """ """ & varFile2 & """ >""" & varFile3 & """"
End Sub