Visual Basic for Excel

I have several hidden workbooks loaded at startup that contain excel macros used to modify certain special workbooks. I also have a number of modules that are universal and contain procedures and functions I'd like to use in any project that I load. The file containing common modules is S.XLS and special workbooks C.XLS and D.XLS VB for Excel recognizes each sheet as a project. As I read the on-line help, to refer to procedure TestSub in module MySubs in Project S.XLS from procedures in project C.XLS the code would be:

sub UseTestSub

[S.XLS].[MySubs].TestSub

end sub

This produces an error that the file doesn't exist. Is there a correct way to access SUBs and Functions from another project

Should I be doing something different with my standard procedures in S.XLS to load them for use by procedures in any other projects



Answer this question

Visual Basic for Excel

  • Gess Man

    Moved to VBA forum

  • JJ Unbreakable

    There are a variety of ways to handle this. You could set a reference to S.XLS in any special workbook which uses its procedures. Or you could call the procedures using

    Application.Run "S.XLS!TestSub"
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______
    


  • esenterre

    In the VB Editor, select References from the Tools menu, and check the box in front of the appropriate project.

    - Jon 
    ------- 
    Jon Peltier, Microsoft Excel MVP 
    Tutorials and Custom Solutions 
    http://PeltierTech.com 
    _______ 
    


  • Upplesnuffaguss

    Could you tell me more about "setting a reference to S.xls". S.xls contains a lot of my standard procedures and functions that I'd like to be able to use in other projects.
  • Visual Basic for Excel