Autoinstall Comdlg32.ocx?

560 Views Asked by At

I'm wanting to distribute an Excel spreadsheet with a form including a comdlg32.ocx component to a networked share.

Windows 7 users likely won't have this component installed or registered. Is there a way to automatically check and then possibly install this component in Windows 7?

1

There are 1 best solutions below

2
On

I once had some code which did something along the lines of

on error goto errhandler
try to instantiate an object of type x
we're not in the error handler - the dll must have already been registered! 
continue processing...
exit sub (or whatever)

errhandler:
shell "regsvr.exe /s " & path_to_dll
retry instantiation

Obviously you'll want to avoid getting into an endless loop if the regsvr call fails. Plus, I wouldn't recommend registering the dll on the network share; it might not be available the next time the macro runs. Try to copy it to the local drive first.

One more thing to consider: You shouldn't really be copying a single system DLL, since they're released in sets and doing so can cause versioning issues. Sometimes, though, I've also found it easier just to take the risk and move on.