Persisting Dynamic Controls in Excel application-level Add-in - excel

I'm developing an Excel Application-level Add-In, and I want to save the Windows Forms Controls I add dynamically to the document, because by default, Excel removes all the controls after closing the document.
Here is everything explained: http://msdn.microsoft.com/en-us/library/cc442765.aspx
"Store information about the size, location, and state of the controls when the document is saved or closed. In an application-level add-in, you can save this data to a custom XML part in the document."
As it is said in the MSDN, I have to save the controls and re-create them after opening the document, but I am not able to store them in a custom XML part.
I have had a look at http://msdn.microsoft.com/en-us/library/bb608612.aspx, but I still don't know how to do it.
Basically, I have a List of controls added to the document, and that's the object I have to save.
Microsoft.Office.Interop.Excel sh;
Microsoft.Office.Tools.Excel Worksheet vstoWorksheet = Globals.Factory.GetVstoObject(Sh);
//This is the List I have to save.
vstoWoorksheet.Controls
Thank you for your time, I hope someone can help me.

Related

Raise an Event within an Excel-Addin when a Userform is loaded by the Excel Application or other Addin

I need to detect from within an excel-addin when a userform is loaded into memory without using the Initialize- or Activate-event of the loaded userform.
I'm currently trying to extend an Excel app by a translation addin to provide for the users a multilanguage GUI. Up to now, I could manage to translate on the fly all visible text-entries on (work-)sheets including comments, screentips and form- or ActiveX-controls embedded in shapes located on the sheet by passing the sheet object to a class which examines the sheet and its objects for text-entries needing translation and translate the identified text entries.
The next challenge will be to design a similar class for examination of userform-text-entries to be translated. Unfortunately, Excel does not provide a method to check upfront if and how many userforms can be loaded other than querying the VBE designer. In my case, VBE has to be locked and password protected so VBE cannot be used for querying for userforms. In addition, the Initialize and Activate events of the main application userforms should not be changed.
Due to my observations, the userforms collection is only populated when the userform is loaded and if the userform is an object of ThisWorkbook, so userforms designed within an additional addins are not part of the main application userforms collection.
The only chance I currently see, is to provide an event when a userform instance is loaded into memory causing a ThunderDFrame class window to pop up within the Excel window tree.
which then can be used for passing the userform-object to the examination routine.
Any idea how to achieve this within VBA? I assume, it might be possible by subclassing the Excel application with the API function SetWinEventHook to detect ThunderDFrame class window creation but my programming skills are not sufficient to figure this out on my own.
Any other approach is also welcome.

How to save a COM control's data to a existint excel file?

Here's the thing.
I develop a COM control using ATL in VS2015, and implement the IPersistStorage and IPersistStreamInit interface(through template in ATL), I register the control and Open a existing excel file ,and Add controls via COM add-ins.
My Question : How to save the control's data to the existing excel file. When I open the file next time , the data saved in control last time can present.
plus:
first, my excel file is common file storing data;
second, I can not find the container application(namely excel file)'s store interface!
third, excel file as a compound document,Whether the IStorage interface is implemented?if not,any other Interface I can use?

lotus notes the design element is hidden and cannot be edited

Appreciate your help.
I have old lotus notes database. Even having manager access it cannot open in designer.
So, took archive of the database was able to open in designer. Now when I am trying to open code of agents, scripts, formula, etc in current lotus notes version 8.5.3.
It throws error "the design element is hidden and cannot be edited".
Please could you guide on how to view code.
You have a database with hidden design here. Unless you find the template, that it was created from, there is no way to "unhide" the design as it is only stored "Compiled" in this case.
It it possible to get back "some" of the information using a HEX- Editor on the nsf file, but this will not bring you further than you already are with your backup: You can open in designer but not see any formula (in forms or views)...
When updating a database from a template you can choose to "Hide formulas and LotusScript" and this will result in what you see.
Some vendors already hide the design of their templates to protect their intellectual property. In that case you will not find an "open" template and cannot get the code back.

SharePoint Designer 2007 - link to a Document Library on a site from another site?

I am trying to create a link to an existing Shared Documents folder on another site. Both sites are on the same server.
Here are the steps I take to create a link to an existing Document Library:
I create a document library web page in Share Point 2007.
I open the document library (AllItems.ASPX) in Share Point Designer.
I delete the existing web part for the list.
In the Data Source Library, I click on "connect to another library" and create a connection to the other site.
I select the document library, click show data, select my rows and click Insert Multiple Item View.
I then configure the look for each field (hyperlinks, etc).
I edit the Filter for this view to show only the files that are for this location.
I click on Data View Properties and select "Enable sorting and filtering on columns (basic table layout only).
Basically I am trying to have a central location for all files for a site and sub sites. I want the sub sites to see the documents for their own location, be able to search through the files, etc.
The problems I am having are:
I am unable to open the links in a new window, even when I set the hyperlink to do so. I would prefer the file be opened in its native application (ie. A Word doc open in Word).
I am unable to show the file icon in the same way it shows up in the original document library.
When I go to the header and click ANY field, I can sort the field ascending or descending but I always get a message stating "This column type cannot be filtered".
Is there an easier way to do this? Or can someone tell me what I am doing wrong? I am new to using Share Point. Thanks for the help!
Some help for problem 1 (unable to open the links in a new window)...
I'm not sure if this will work using the Data View Web Part you have configured. However there is a technique for the List View Web Part. If you add a boolean field called OpenInNewWindow to your document library then documents that have this set to Yes will open in a new window. Try this out - it may work.
If you need to open PDF files in a new window, beware that there is an ActiveX control that will get in the way. Read this question for more information.

must capture document properties for word, excel and powerpoint documents

I am new to VBA and this area. I would like to capture the document proporties like (document title, subject, author, team, manager,company etc...) while create or saving the document. This properties capture is must and i would like to implement to all the Word, Excel, Powerpoint users in my company.
How this can be possible. If I wrote a macro, is it possible to deploy all the MS-Office users. or a VB program will do?.
All i need is to make mandatory to input document properties for all the documents. these properties can also be fetched from a template file from the user machine.
Is this possible in VBA or any other easy ways to do it.
To force users to fill in all the properties before saving the document, you can create add-ins (one for each of Excel, Word and PowerPoint) that intercept the "before save" event and check the document properties. If the add-in detects some properties that have not been filled in, it can prompt the user and cancel the save.
The means by which you can create an add-in is similar (but not identical) across the 3 applications. You would of course also have to ensure that the add-ins were installed on all your users machines.
If you just want to be able to read (or modify) the properties, you can use the Office Document Property Reader to read and write properties of Office documents, without even needing Office installed. That works across all Office applications.

Resources