Excel 2013 Crashes when Adding Userform in Visual Basic window - excel

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?

Related

Workbook tab won't open in VBA Editor

I have weird bug - then I open VBA Editor I can edit and create macros for sheets just fine, but then I try to edit macros for Workbook (create on_open event) I can't access ThisWorkbook tab in VBA Editor. Then I click it - nothing happens. What causing this problem? If I create new Excel workbook I can access this part with no problem (but that is not an option, since it would be to much work to move everything to new workbook).
EDIT: I turned off SOLVER add-in and the problem is gone. But I am still baffled why it was happening and how to avoid this problem in the future, since I sometimes need SOLVER add-in enabled.
EDIT 2: After writing desired routines for on_open and before_close events I restarted my Workbook to test it out. Events did not activated and I am locked from Workbook tab in VBA Editor again. Strangely everything worked fine then I tested it on older Excel version (MS Office 2013, version I am working with - MS Office 2016 version 1912 ) in other PC.

Reference to Outlook becomes missing, leading to Excel error: Unable to Load DLL In Excel 2010

I have a macro to import data from Access to Excel. One component of the import is to prompt the user to see if they would like to email the workbook. If yes, then a new email opens with the workbook attached. To accomplish this, I referenced the Outlook 14.0 object library.
After a few refreshes of the data from Access, I began to get run time errors which I have since fixed. However, now I get a notice that Excel is "Unable to Load DLL" when I try to open a module to modify it.
When I look at the libraries referenced, the Outlook library indicates that it is missing. I am unable to deselect the library in Excel 2010 and have to open the workbook on another computer that is running Excel 2016, where everything works. Once I deselect the library and save it, I can use the macro again in 2010 and modify the code.

Missing reference and "Error in loading DLL"

I have an Excel tool I've been building at work to automatically generate PowerPoint charts from data on Excel sheets. I've been moving the project back and forth between my work and home computers.
At work I have Excel 2013 and at home I have Excel 2016. So when I move the file from home to work, I have to go into references and uncheck the "MISSING: Microsoft PowerPoint 16.0 Object Library" and check "Microsoft PowerPoint 15.0 Object Library"...no big deal.
Until this morning. When I open the VB Editor I get a messagebox
Error in loading DLL
I can't open any of the forms of modules...I just get that messagebox.
When I go to references I've tried
Uncheck the missing entry for v16 and check the entry for version 15
-- I get the error in loading DLL message
Just unchecking the entry for v16 -- I get the error in loading DLL
message
Leaving them both checked -- I (obviously) get the error message
"Name conflicts with existing module, project, or object library"
Uncheck the missing entry, check the correct entry, and move its
priority above the (unchecked) missing entry -- I get the error in
loading DLL message.
Had this issue before. My macro used the Microsoft Outlook 12.0 Object Library and was designed to work with that for all users of the team. However since an update to Office 365 was planned one of the IT guys had opened the macro with the new Office 365(and Microsoft Outlook 16.0 Object Library was set to be used). After this all of the users had:Error in loading DLL on their screen as they were still on the old Office 2007 and the new library Microsoft Outlook 16.0 Object Library was in the References list. Tried in vain to unselect the new one and select the old library.
My solution to this issue:
open a new excel file(not a macro)
go into the Ribbon(office 2007 & 2010)->Excel Option->Trus Center tab->Trust Center Setting button->Macro Settings
select option: Disable all macros with notification and then click Ok button
Close the Excel file opened(not the excel window) - from the lowest X on the right corner
Open the macro using the Ribbon and then option Open
Get into the dev mode(ALT+F11) and go to Tools->References then unselect the broken Excel library(the one with MISSING:)
Select the correct library from the list and click OK
Save the macro and then close it.
Revert the selection done at step3 to option:Enable all macros and Voila!

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

UserForm ActiveX controls not working on new machine

I built a workbook in Excel on my old machine that has a bunch of UserForms in it. One of the UserForms has an ActiveX spreadsheet control in it. This allows me to enter spreadsheet data into the UserForm. My old computer recently crashed so my IT department gave me a new machine that is running the same system (Microsoft Office 2010). Now, when I open the spreadsheet, I get:
Could not load some objects because they are not available on this machine.
I Googled this error and read through a number of pages. The first thing to try was installing Microsoft Office Web Components 11.0. Weirdly, this allows me to add a spreadsheet control to any UserForm I want to but I still cannot open the original sheet with all of its controls still in it.
Next, I tried these instructions but got no results.
Does anybody have any ideas?
Add a reference to Microsoft Forms 2.0 Object Library (found as FM20.dll)
Hth

Resources