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.
Related
There is an Excel add-in that allow users to make comments (not the traditional comments provided by Excel) for spreadsheet cells. The add-in memorizes all the cells that have comments in a workbook.
I am wondering where these information are actually stored. Are they stored in some hidden part of the workbook? Are they stored in the server of the add-in, then how are workbooks identified?
If you're referring to an add-in that somehow "remembers" a particular Range across document open/close sessions (e.g., how the Bing Maps add-in does it), it's using Bindings beneath the covers. Bindings -- which are conceptually a lot like the user-facing Named Ranges, but are invisible and are per add-in (so no name collision risk) -- are stored in the document, just like named ranges.
As Kim points out, this is often combined with Settings to create an add-in that both binds to some ranges (with a GUID-like name, for example), and stores some metadata keyed off of the binding name.
On a side note, if you want to reference ranges only for a specific duration of time while the add-in is running but you don't need these to persist in the document, you can instead use object-tracking. It is described in great detail in the book "Building Office Add-ins using Office.js", (disclaimer: I am author of said book), in a chapter called "Using objects outside the 'linear' Excel.run or Word.run flow (e.g., in a button-click callback,in a setInterval, etc.)".
Using the Office.js API, you can use the Settings object (Office.context.document.settings) to store name/value pairs in the host document. For details about how this works, see the documentation here: https://dev.office.com/reference/add-ins/shared/settings.
As the documentation indicates, the settings that you create/save using the Settings object are saved per add-in and per document, which matches the scenario that you've described. Regarding where settings data actually gets stored, check out the answer on this other Stack Overflow post -- which describes how/where settings data is persisted for a host document. (Note: I haven't personally verified that answer, so I'd suggest that you do some testing to verify/confirm its accuracy for your scenario.)
On an out of the box sharepoint online site i can find on the document library under the "New" button the most common office documents like word, excel, powerpoint and so on.
but as soon a i add an additional content type to the library. I can find the the created content type, for example the picture, but only word document and the other office tyoe like excel and pp are gone. After i remove the picture content type all type of office files a showing up again.
Why is that, and how i can bring back the excel an other office types on the new button.
thanks
This has already been answered here:
https://sharepoint.stackexchange.com/a/192058
As it turns out, these "content types" comes from Office Online Server
(formerly knows as, Office WebApps Server). The only way to change
them is by adding custom content types. That goes from reordering as
well.
If you only have the default document content type then the new button
will default to the 4 basic documents that can be created in Office
Online server. If you add custom content types then the assumption is
that each custom content type has a custom template associated with
it. So then the New button will default to showing you the different
document templates associated with each content type. This is all by
design,
Paul Stork on O365 Network
We have an application to track work orders (hundreds of thousands) built on an Oracle database. Data entry is cumbersome and report features non-existent. IT is inflexible. We do not get support from that end. Accordingly, users have created Excel "tools" to run queries and make sense of data using ADO or ODBC connections.
What we also need is a way to record comments on specific work order (WO) records and have those comments travel with those records somehow. There are multiple users using their own spreadsheets, all querying the same database.
I'm envisioning a junction-table approach, perhaps using Access, where some VBA could take a users comment from the row in the worksheet, capture the WO number, user id, date, and comment text and store it in an Access table. Those fields could then be retrieved by some more code. This would allow any user to see all comments by any other user related to a specific WO.
I'd greatly appreciate feedback ... on the practicality, preferable constructive, but brutally honest is ok too.
Much thanks,
Kevin
Apart from this being a horrible mess you could:
use SQL Server instead of access - you can get a free copy that will probably cater for your needs. Access will also work, but it is bodge. SQL server is more professional!
I would avoid doing data entry in excel. You could build a front end (possibly in Access with SQL Server backend) that allows data entry. You could add pretty simple code to all your workbooks, which will probably reference code that will be in an excel addin. The addin has code to simply open an access database, open a form and find the WO that the user was viewing in excel.
2a. Or you could use an excel addin with a data entry form, to do data entry, but beware managing the locking, refreshing and update of displayed data.
Creating excel addins is easy, (re-)distributing them is easy, access (or whatever front end you use) is designed to do record management (ie lock and update or lock and cancel or just view) etc.... Plus you want to avoid addinghte same or similar code to all your workbooks.
Each users workbook would have very simple code. Just to tell the addin what WO you want to operate on.
Do you have sharepoint? If so Access 2013 can deliver forms as webpages - very easily, so you might not even have to manage a front end access file.
Happier now?
For those that may stumble on this post, what we ended up doing was use VBA to store comments in a separate SQL database. Users double click the cell with the WO number to get an input form prompting for comments with options to add new, append or remove existing. Entries are passed to the SQL db and also to columns in the worksheet so users can see all the entries. Time stamp/Network ID provides when/who provided comment. Existing comments are fetched when users re-open file. Works great.
I have a system with an Excel spreadsheet template file which is used for invoicing. I would like the user to be able to click a button on an Xpage, which will then open the spreadsheet and enter the latest invoicing data in Excel. I don't mind if Excel is either the application on their machine or on the server, but my preference would be the application locally on their machine.
I've looked into Xagents, as I feel this is probably the answer. I know they can be used to create Excel but I have not been able to locate any mention of opening an Excel file, and entering data into specific cells.
Is this possible?
EDIT: you can use Apache POI for editing and creating Microsoft Office documents. This is a java project which gives you a handle to office documents and this can be used using java.
A good starting point can be the blog of Christian Guedemann from webgate:
http://guedebyte.wordpress.com/2012/09/17/documents-and-spreadsheets-with-xpages-building-the-kernel-part-ii/
(end of edit)
The only way I KNOW and tried to write data from Notes to Excel is exporting the data to an HTML page and setting the Content Type accordingly (e. g. as described here (there are a lot more resources available for taht):
http://www.dominoguru.com/pages/developer2010_xpagexlsexport.html
I am not sure if this is of help but it seems that this project can help you:
http://www.openntf.org/internal/home.nsf/project.xsp?action=openDocument&name=ZK%20Spreadsheet%20for%20XPages
As far as I can see this project can load Excel files from XPages - and then it should also be possible to edit the files.
Besides that the only solution I can think of is a Notes Agent that is called from the XPage. This agent can then run in background and do all the excel stuff. After running, the XPage can show a link to the Excel file. Actually this is the solution I would consider to implement - but maybe others step in with better answers here.
You don't want to introduce a dependency on Excel in your application -- wouldn't work with an iPad front-end. Rather have a look at the ZK Spreadsheet, it will fulfill your needs.
However if you have to have Excel, then you need a roundtrip solution: load the Excel from an URL (probably generated by an XAgent (?) and save it back. The saving back part is the tricky one. Normal HTTP doesn't allow that. What you need there is a webDAV capable server. Watch out for a project on OpenNTF soon (just clearing IBM legal) that provides webDAV.
However the ZK Spreadsheet looks much better for your needs.
I have a sample database at the following URL --> http://www.nnsu.com/nnsusite.nsf/%24%24OpenDominoDocument.xsp?documentId=B65507CB2DE15B3286257986005F061D&action=openDocument
Download the APCC.nsf. This will allow you to create/read a new EXCEL spreadsheet and then stream the resulting file to the requesting browser. There is not need to have EXCEL or office installed on the Server.
THe examples create a new workbook, but you can also store a "template" on the server or in a notes document and use it as a starting point and then save it to a document or stream it to the requesting browser.
With Apache POI you can read/write to a spreadsheet using data from the notes document the process is initiated from.
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.