"VBAProject" name conflict - vba

My issue involves PowerPoint Add-Ins all being named VBAProject.
Microsoft Office Pro Plus 2010 - PowerPoint 2010 32 bit
Running Windows 7 Pro SP1 64 bit
I have several add-ins for PowerPoint saved as .PPAM files. In any PowerPoint file I can (or should be able to) link add-ins to extend that presentation's functionality. Each .PPAM file is named differently. In the VBA IDE however, in the list of references, each add-in is called 'VBAProject'. There are multiple entries of 'VBAProject' each one showing a path to a different .PPAM file. The problem is that I cannot add a reference to more than one add-in because the same name assigned to each of these; VBAProject. This results in a name conflict. Using the add-in manager from PowerPoint design view I can see all the selected add-ins as being 'active'. The Add-in manager for the VBA IDE shows no Add-ins.
Questions:
Is the naming of PowerPoint Add-ins as 'VBAProject' expected for every add-in?
Is there a way of change the name 'VBAProject' to something unique and hence avoid the name conflicts?

So it seems as if I have found the solution to my problem and would like to share it with the community. It involved a small change to the registry. [Be careful when dealing w/ the registry and make a back-up prior to any changes.]
From Regedit.exe -> HKEY_CURRENT_USER\Software\Microsoft\Office\14.0\PowerPoint\Options. Change value of DebugAddins from 0x00000000 (0) to 0x00000001 (1).
With this done you will be able to see all the add-ins in the VBA IDE and from there you can change the name 'VBAProject' to something unique.

Related

Is PowerPoint automation from Excel possible with Office Add-Ins?

I have a VSTO add-in for Excel that automates PowerPoint, creating new presentation documents and generates slides and other content based on the data in the current Excel workbook. (Using the Primary Interop Assemblies, it creates a new instance of the PowerPoint Application, adds a new Presentation object, Slide objects etc.)
Is it possible for a new Office Add-in to do this so it would run in Excel online, on the Mac, and so on?
It looks like I can get the context of the Office application I'm currently in (e.g. Excel), but I don't see how I can reference the PowerPoint object model, or automate anything outside of Excel itself.
Is this what Microsoft means when it says to create a VSTO add-in
"...or to extend Office 2013 and Office 2016 beyond what's possible
with Office add-ins. VSTO add-ins run only on the desktop."
rather than building a new JavaScript/HTML Office Add-In?
Thanks.
No, it is not possible. Web add-in are on different platforms like Mac where the COM automation technology doesn't exist.
Instead, you may consider using the Open XML SDK instead for generating PowerPoint files on the fly from your Excel web add-in. See Welcome to the Open XML SDK 2.5 for Office for more information.

Running functions from Excel Add-Ins in vba, is there an easier way than using Run "mySub"?

I'm trying to create my first Excel Add-In for Excel 2010. Most of it is working, it's running from the ribbon buttons, but I'm having trouble addressing the Add-In's subroutines from my workbook's VBA code.
According to this answer on SO, it should be possible to simply use the syntax:
mySub
or
Call mySub
But this causes the error "Sub or Function not defined". I've only managed to run them this way:
Run "mySub"
or
Application.Run("myAddIn.xlam!mySub")
Is there a way to include the Add-In so I can address it the easy way?
The Add-In is already checked in the Tools->Add-Ins list, and has a unique name (CalcFunctions) which is different from its file name (CalculationFunctions.xlam). The Add-In file is on a different disk and I'm working on a server, but I don't expect that that matters.
(Posted on behalf of the OP).
Turns out I'm just dumb. I only set a reference to the Add-In in the regular Excel window. I assumed that was what people meant by Tools->References->Add-Ins (I use Excel in Dutch and there's no "Tools" menu). Anyway, the solution was setting a reference in that menu in the VBA editor window.
Here's how to add a reference in VBA:
ThisWorkbook.VBProject.References.AddFromFile refPath
With refPath being the full path to the file.
To be able to add references you need to have permission to edit the VBA project. You can enable this in excel settings->trust center->macro settings. If you're on a company pc it's likely the administrator has to set these settings for you.

Permanently append Customized Ribbons to PowerPoint file

I have written 2 Macros in PowerPoint and added the Macros to a customized ribbon named 'My Ribbon' to make those macros available at a click of a button. The only problem is the Ribbon disappears when someone else opens the PowerPoint on a different computer. The macros stay with the file but the customized ribbons do not and we have to create another customized ribbon, and place both macros to the ribbon every time we share the file across our drive.(Which is quite annoying)
I want to permanently append the customized ribbon to the PowerPoint so that anyone who opens the PowerPoint will be able to see the personalized ribbon with both Macros already on their version of PowerPoint.
VBA macros are not designed for distributing the code on multiple PCs. If you need to get a solution which can be installed on other PCs you need to develop an add-in. That's exactly they were invented for. Moreover, you can create an installer for the add-in. It will be installed as other applications on your PC. See Walkthrough: Creating Your First Application-Level Add-in for PowerPoint to get started.
If you choose to stay with VBA macros, you will have to edit the open xml document. See Customize the Word Ribbon User Interface for more information. The process is common for almost all Office applications (Outlook does't support that).
You could use such a program like Ribbon Editor to customize the Ribbon for your pptm file only. (No need for an AddIn it you want it deployed only with the file)

Allow for users to change sheet names, VSTO

This is similar to my question here, but my workaround dosn't help for these instances and the cause is more defined. I have a workbook level customization that will add sheets from a folder where it retains the name of the sheet that was copied in. This works well and doesn't cause any problems unless the user renames the sheet. If the user renames the sheet, saves the workbook, and then come backs to it, then tries to do any action which references the workbook or worksheet they get the error:
Microsoft.VisualStudio.Tools.Applications.Runtime.ControlNotFoundException:
This document might not function as expected because the following control is missing:
Sheet5. Data that relies on this control will not be automatically displayed or updated,
and other custom functionality will not be available. Contact your administrator or the
author of this document for further assistance. --->
System.Runtime.InteropServices.COMException: Programmatic access to the Microsoft Office
Visual Basic for Applications project system could not be enabled. If Microsoft Office
Word or Microsoft Office Excel is running, it can prevent programmatic access from being
enabled. Exit Word or Excel before opening or creating your project.
Now closing and opening the Excel doesn't help, moving the sheet to a new position doesn't help, and deleting the offending sheet doesn't help if more than 1 sheet has been added. The base template has 6 sheets, and I've tried adding the sheets to the middle (where we would want them) and at the end (just for kicks). This doesn't seem to help. If you delete all the added sheets, save the workbook, and open it again, then functionality is restored. The sheets that are added are not named sheets in the VSTO, but are referenced mostly by number or name (there are 6 sheets to start with, so if they get added after 3 they would have an index of 4 to (ThisWorkBook.Sheets.Count-3), or if Sheet.Name is not any of the names from the original 6 (which they would never be, and I have scripted a prevention for).
My problem is that I really need to be able to allow the users to add a generic report sheet if the ones I've designed won't work. This means I need to be able to add a sheet, allow them to rename it, save it and come back to it. This error doesn't happen until the sheet has been saved, closed, and re-opened if that helps anyone. I also can not replicate this on any machine with VS2012 installed, even if the project was never worked on in that computer (VSTO just installed). Though all those VS2012 machines were used for other Excel VSTO projects. I can however replicate it on XP-Win8 and Excel Office '07-365.
**So my distilled question: is there a way to allow a user to add sheets and rename them (outside of the VSTO preferably), without running into a Runtime.ControlNotFoundException?
Thanks.
Basically, you need to re-initialize the sheets as VSTO objects everytime the workbook is re-opened. Since these sheets aren't hard-coded into your solution, VSTO has no way of recognizing them unless your code looks for such things and "re-connects" them at run-time. This is explained in the VSTO documentation:
http://msdn.microsoft.com/en-us/library/cc442981.aspx
But I believe you require an add-in in order to do this for sheets. I don't think it can be incorporated into the workbook's "code behind".

Listview on worksheet generates cannot insert object error Excel 2010

Hi I have an Excel 2003 application which has a listview embedded in the worksheet. It no longer works on Excel 2010.
I re-registered the ocx using regsvr32 C:\Windows\System32\MSCOMCTL.OCX as per advice.
This works for listviews on forms, but not for the worksheet.
Microsoft advises that Cannot insert object can be generated if the control is form specific and an attempt is made to add to the worksheet.
Can the listview be used in Excel 2010 on a worksheet
If so how?
Otherwise a rewrite will be required.
That happened to my Excel files using ActiveX or any sort of automation. The solution was confused at the beginning but the following link will help you.
Create a batch to remove cached control type libraries (extender files *.EXD) files from Windows
Opening each of the projects (Excel with macros)
Switch the file to design mode
Open VBA Code (Alt-F11) to edit any module and press from the main menu > Debug > Compile VBAProject
Switch back to Run Mode
Save and Close File
Reopen the file & test
Form Controls stop working after December 2014 Updates