Excel Startup Files

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a worksheet with some macros needed for several other worksheets. I
have added it to my XLStart folder, however whenever I try to set a reference
to the startup file programmatically I receive an "error loading dll"
message. I have the workbook saved as a .xla, and I can open it correctly
manually. However, whenever I open it using the Workbooks.Open command, it
opens as Filename1, appears in my reference list as "Unsaved: FileName" and
I can not access the various modules in the code.

What do I need to do to make the code in this workbook available to other
workbooks?
 
If you have it saved as an add-in you could load it once as an add-in
excel>Tool>Add-Ins>Browse
 
Unfortunately, that is not working for me either.

Here is the code I am using for the file as an add-in (modified code from
www.jkp-ads.com/Articles/DistributMacro10.htm).

Set fso = New Scripting.FileSystemObject

If fso.FolderExists("K:\Windows") Then

setDir = "E:\"


Else
setDir = "C:\"

End If

CurAddInPath = setDir & strDirectory & sFileName
AddInLibPath = Application.LibraryPath & "\" & sFileName

FileCopy CurAddInPath, AddInLibPath

With AddIns.Add(Filename:=AddInLibPath)
.Installed = True
End With

This code selects the add-in, but the other code can not access the modules.
Am I missing something?
 
How are you to trying to get the other programs to access the macros in your
"add-in" ? instead of setting a refrence to the workbook can you just do this?


Application.Run("MYMACROPAGE.XLA!My_Func_Sum",MyArgumentList)

ben
 
I tried this option and it does not work. I am basically doing some
authenticating using SQL statements and stored procedures on the Worksheet
Change event. This code works great when in the actual worksheet, but I have
about 10 worksheets that need this code. There is one piece of the code that
sets a validation for our various offices. However, this information can
change. I am trying not to have to edit each worksheet when we close/open a
new office.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top