Loading add ins at startup referencing the current workbook

dpaton05

Well-known Member
Joined
Aug 14, 2018
Messages
2,352
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am trying to use the date picker here, Excel Date Picker — Sam Radakovitz, and with it, you need to load an add in at startup. I want the add in to load automatically so I am going to enter the folder name where it is located here:
1607466594846.png


The only problem is that I am still developing my spreadsheet but the folder structure will be the same when I go live so I will copy the folder I am developing onto my network drive. I want to reference the current folder in my version while I am testing on my personal drive, but seeing as though the live version will have the same file structure, it will still work and be able to find the add in.



For instance, I do not want
C:\Program Files (x86)\Microsoft Office\ [version] \xlstart
entered in the box.

What I want is
%someway to reference the current folder%\addins
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You can trial this code. This part will give U info about your com addins not in the XL start menu....
Code:
Dim FolDir As Object, FileNm As Object, Fso As Object
Set Fso = CreateObject("scripting.filesystemobject")
Set FolDir = Fso.GetFolder(Application.UserLibraryPath)
For Each FileNm In FolDir.Files
MsgBox FileNm.Name
Next FileNm
Set FolDir = Nothing
Set Fso = Nothing
I think this maybe what you're after for installing the addin...
Code:
Dim Fso As Object, SrcFolderStr As String, DestFolderStr As String
Set Fso = CreateObject("scripting.filesystemobject")
SrcFolderStr = "C:\YourFolderName\AddinTestName.xlsm"
DestFolderStr = Application.UserLibraryPath & "AddinTestName.xlam"
Fso.CopyFile SrcFolderStr, DestFolderStr, True  'source,destination,save
Set Fso = Nothing
So this should always reference the add in path...
Code:
Application.UserLibraryPath & "AddinTestName.xlam"
I've been wrong before? HTH. Dave
 
Upvote 0

Forum statistics

Threads
1,214,982
Messages
6,122,580
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top