Update UDF for Win 10

picklefactory

Active Member
Joined
Jan 28, 2005
Messages
412
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

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
 

Some videos you may like

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

JackDanIce

Well-known Member
Joined
Feb 3, 2010
Messages
9,720
Office Version
  1. 365
Platform
  1. Windows
A guess is DOS command prompts can't be launched programtically due to Win 10 security? Have you checked with those who installed the upgrade?
 

picklefactory

Active Member
Joined
Jan 28, 2005
Messages
412
Thanks Jack
Never gave that a thought TBH, it's a new pc entirely. I'll fire a question to our IT.
 

Fennek

Active Member
Joined
Nov 21, 2016
Messages
279
Hallo, if there are security issues, try to write your Shell-command in a *.bat- file. This will not work either, but if you create a shortcut (*.lnk) and address this in the VBA-Shell it shoud work. regards
 
Last edited:

picklefactory

Active Member
Joined
Jan 28, 2005
Messages
412

ADVERTISEMENT

Thanks Fennek
The batch file is easy, but how do I create/use the *.lnk shortcut? Is that just as easy?
 

picklefactory

Active Member
Joined
Jan 28, 2005
Messages
412
Haha... thanks Jack, that doesn't fill me with confidence. I've been aGoogling, and it doesn't look simple.
:)
 

Watch MrExcel Video

Forum statistics

Threads
1,127,197
Messages
5,623,308
Members
415,965
Latest member
Sixaside

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top