0

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?

ForEachLoop
  • 2,508
  • 3
  • 18
  • 28

1 Answers1

0

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.

Tom Juergens
  • 4,492
  • 3
  • 35
  • 32
  • I've not had time to explore this option but does this works for Windows 7? To do that manually you need to be in the command window with Run As Administrator level. – ForEachLoop Apr 20 '11 at 14:11
  • Ah, good point, you may be right. I hadn't thought of that. Back when we used this solution this wasn't an issue. – Tom Juergens Apr 20 '11 at 22:11