function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
PhilWorksPhilWorks 

VBA code runs fine from "personal.xls" but can't make it run from "Module 1" or "This Workbook"

Hello,
The Excel Connector works great.  I'm using it successfully lots of ways.  But I have a problem.
 
I have code that runs fine when it's stored in a Module in "personal.xls", which is located in C:\Program Files\Microsoft Office\Office 11\XLSTART.
However, it's difficult to maintain the code from that location.  I'd like to place the application on a shared drive.  This means that my "template" workbook.xls would need the code stored in "Module 1" or "This Workbook".  However, when I copy the code there, it won't work.  I get the error "Compile Error: Variable not defined" and it highlights the code: "sforce_connector"
 
I use the following sforce commands at various points in this application:
sforce_connector.logout
varUsersName = sforce_connector.sfUserName(strSfUserID)
sforce_connector.sfQuery
sforce_connector.sfInsertRow
 
They all work fine when stored in "personal.xls" but won't work in a standard workbook.  I don't understand why.  Thanks for your help.
 
PhilWorksPhilWorks
The issue is in setting up References.  (Tools/References) and clicking on "sforce_connector". 
I thought References were seup only once, and would be applied to all workbooks.  That is NOT the case.  The sforce_connector must be selected for each and every workbook where you wish to call the functions.  I hope this helps other folks with the same problem.