0

I am making an excel vba program which will be distributed accross my entire organization, to people I don't even know.

I have been building it with early binding everywhere to make the code more readable, enable intellisense and easier to write.

The side effect of this is, I am not sure my program will work on another computer.

How can I write code with early binding in a way that it will run everywhere without explaining to the user how to add the references for every single computer it will run on ?

Shodan
  • 1,065
  • 2
  • 13
  • 35
  • 1
    Check this, very details explanation https://stackoverflow.com/questions/9879825/how-to-add-a-reference-programmatically – Kin Siang Jun 05 '21 at 01:19
  • If all users have the same setup as your pc then it shouldn’t be a problem – Tim Williams Jun 05 '21 at 01:19
  • Tim, at minimum I know they won't have the MS scripting runtime checked (and there will be others). That means packaging a separate file with instruction for the user on how to manually add each required references. Kin, thank you adding the references this way will make it easier ! I just to figure out how to tell user to enable "Trust Access To Visual Basic Project" (and also not anger IT !) – Shodan Jun 05 '21 at 01:35
  • Just show them the instruction on how to tick the `Trust Access to VB`, since it is create within company, there wont be too much problem – Kin Siang Jun 05 '21 at 02:05
  • Unfortunately I do not know who they are, there are thousands of employees where I work and I expect they will just pass around copies of the file to anyone who might need it. I can't go to each person and tell them. Also I work the evening shift and can't reach each person. I hope they will figure it out. I will tell the first person who I send the file to how to do this. Hopefully they will pass this information along with the file. – Shodan Jun 05 '21 at 02:09
  • 1
    If you share the file and the file has the reference checked, then it will be checked for your users also, and there will be no problem as long as the checked libraries are registered on their PC. I do this all the time with zero hand-holding required. – Tim Williams Jun 05 '21 at 02:28
  • 1
    '"Trust Access To Visual Basic Project" (and also not anger IT !)' - that is not a good direction to go in if you don't want to upset your IT group (besides being unneccessary). That setting is **off** by default for a reason... Putting in the time to switch to late binding would be much better than asking folks to enable that setting. – Tim Williams Jun 05 '21 at 02:30
  • Oh, thank you ! My mistake then ! I believed the reference had to be checked for the whole computer rather than only the file ! Then the premise of this question has fallen apart. Early binding should work everywhere already ! thanks – Shodan Jun 05 '21 at 02:32

0 Answers0