Excel 2007 does not allow reference to xlam from xlsm - excel

I am running Excel 2007 under Windows 7 Pro.
I have two add-ins which I have saved as .xla, i.e. as "Excel 97-2003 Add-in".
One is a "Master" add-in, which refers to the other, the "Slave" (through Tools > References)
In VBA, I am able to make a reference the Master add-in from another spreadsheet saved as .xlsm format. It appears to work fine.
Problem:
I change the format of the add-ins from .xla to .xlam (this is non-trivial, involving saving as .xlsm format in between)
I change the reference in the Master .xlam to point to the new Slave .xlam. That works fine, and can be tested.
But when I try to reference the master from the .xlsm spreadsheet, then I get the message "Can't add a reference to the specified file".
If I try again I get a message that just says "400".
Can anyone suggest why it is not possible to add a reference to .xlam from the .xlsm? The code is identical across the two add-in formats. There is no problem in referencing from the Master .xlam to the Slave .xlam . The problem only appears when trying to reference the Master .xlam from the .xlsm spreadsheet.
Both add-ins also refer to other libraries:
Visual Basic for Applications
Microsoft Excel 12.0 Object Library
Microsoft Office 12.0 Object Library
Microsoft Scripting Runtime
Microsoft Forms 2.0 Object Library
I also tried saving the Master as .xslm, and referencing that. It works fine but of course the worksheets of the Master add-in are then visible, which I wanted to avoid.
Thanks for your help.

Related

Creating Word document from Excel Add-In with Office.js

Is it possible to create a .docx file from an Excel Add-In written in office.js?
My use case would be to open an Excel file (on Windows, so the host is an Excel Application), open the Add-In and the Add-In creates a Word document based on data within the Excel file.
From the things that I've seen, it is not possible to call the Word.run() host function from inside a Excel Add-In. I will always get an error that the namespace Word is unknown.
Is this even an intended feature to make 'cross-host calls'?
I had almost the same question: How to get the active PowerPoint presentation from Excel in office.js? and got the answer:
An Office add-in can only work with the Office application (Excel,
Word, PowerPoint, etc.) in which it is open. It cannot reach outside
the Office application to work with a document in another Office
application.
Eventually I moved back to VSTO and C#

Excel 2013 Crashes when Adding Userform in Visual Basic window

I have a user who just got a new computer (Windows 10 Pro running Office 2013) and he can no longer open a macro enabled workbook.
I finally identified that the Userforms are causing the issue when I created a new workbook and added some VBA to it. Everything worked fine until I went to insert a Userform, that's when it crashed. I did some additional testing and found he can open .xlsm files except when a userform is in the VBA.
I looked into the References in the VBA window and checked the libraries, he seemed to have what he needed and I added anything I thought was missing but nothing helped.
Visual Basic for Applications
Microsoft Excel 15.0 Object Library
OLE Automation
Microsoft Office 15.0 Object Library
Microsoft Forms 2.0 Object Library (keeps unchecking itself but even when checked doesn't help)
Ref Edit Control
What references could I be overlooking here?
The VBA code is not affecting it, I ran the opening code without any forms and it opened and enabled macros just fine.
What is preventing Excel from running a macro enabled workbook with userforms or adding a userform?

Excel 2013 - "At startup, open all files in": only works first time

Afternoon all,
I've just upgraded to Office 2013 and I'm trying to get to grips with it.
Since Excel 2003, through 2007 and 2010 I have created and used standard templates for new workbooks and sheets which I store in a specific location. I use the "At startup, open all files in" option in the Advanced Excel options to reference this location so each time a new workbook or sheet is opened, it uses my templates.
In Excel 2013 it works in the first workbook but any workbook after that I open just opens as standard. If I create a new instance of Excel by holding down Alt when I click on it, it also works correctly. It seems as if the change in Excel 2013 to open up workbooks in the same instance which behave as separate instances has the downside of the startup files not being accessed.
Does anyone know how to correct or get around this?
Edit: Same problem if I use the default XLStartup folder
SliderSteve

How to recognize that Excel is really closing in an XLL add-in?

According to MSDN, Excel will call xlAutoClose on an xll add-in, when the add-in is unloaded (be it because excel is closing or maybe the add-in is being removed manually).
Unfortunately xlAutoClose is also called when the user tries to close the spreadsheet, but then cancels when prompted to save their work.
According to the Excel Add-In dev documentation ("Financial Applications using Excel Add-in Development in C / C++"), when Excel is really closing, xlAutoClose will be followed by a call to xlAddInManagerInfo. Unfortunately I found it to be not true (tested both on 2007 and 2010 versions of Excel).
Is there any reliable way for an XLL add-in to distinguish between attempted spreadsheet close and actual spreadsheet close?
Thanks,
Luke

Make a VSTO Excel 2016 Workbook Application portable/without setup?

I have the following situation:
I developed a VSTO Excel 2016 Workbook, which triggers some code when you copy/paste an Excel Worksheet in the above mentioned Workbook. When i publish the project (Project Properties > Publish > Publish Now), Visual Studio creates the following in Folder:
Excel Workbook(.xlsx)
VSTO file(.vsto)
setup.exe file
The Workbook only opens without error when i first run the Setup, wich obviously installs the .vsto file.
My Question:
Can you generate/publish a .xlsx Workbook which is portable, i.e. you dont have to install anything since the Code is already in the .xlsx file? Because I dont want to run the setup.exe everytime when i switched to another PC.
Or is there even an alternative solution to VSTO/my problem?
The only way to embed and distribute code with a workbook is to use VBA.
There is no way to embed a VSTO solution in a workbook - VSTO was explicitly designed to not allow that for reasons of code maintenance and security.

Resources