Hi,
You can try:
string myName = (string)XlCall.Excel(XlCall.xlGetName);
-Govert
On Aug 10, 10:29 am, Bogey <
f.meh...@googlemail.com> wrote:
> Hi,
>
> I'm stuck on a little issue. I need to know the path of where the .xll
> being loaded is located in order to be able to load database and
> licensing-files from my addon which are located in a subfolder.
>
> Seems like a simple problem, but so far I couldn't come up with a
> solution. If you have any ideas right away, just ignore the rest of
> this message because I'll just try to explain what I have tried so far
> (none of it really worked, though).
>
> First approach:
>
> Just calling
>
> System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAsse mbly().CodeBase).Replace("file:
> \\","");
>
> in my addin. But that only returns the path to the Windows GAC-folder.
>
> Second approach:
>
> Using a function
>
> public static string path() {
> xcelInterop.Application app =
> (ExcelInterop.Application)ExcelDnaUtil.Application;
> return app.ActiveWorkbook.Path;
>
> }
>
> but obviously, there are two problems with that:
> 1. Only returns the workbook path, not the .xll-path, so if multiple
> workbooks in various directories are using the same .xll it'd be
> useless
> 2. Of course only works after the workbook which is supposed to use
> the .xll is loaded. This is my main problem because unfortunately, I
> have to load the .xll before the workbook, so that's not an option.
>
> Third approach:
>
> Since I'm using a seperate .exe file to start up excel, register the
> addin and load the .xls my second idea was to simply have my .exe file
> register an environment variable:
>
> string path =
> System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAsse mbly().CodeBase).Replace("file: