I am trying to write an Excel add-in that would copy data between two workbooks.
What I would like to do is described here, but I would like to do that using the office-js.
Since office-js-based add-ins also work in the web browser, I would probably need to create a new Excel workbook from second (non-opened) workbook data and then copy the data over to the first workbook. I found the API call that allows me to open the workbook, but I am at a loss on how to use that workbook (get the data from it).
Any suggestions would be greatly appreciated.
Currently, Office Web Add-ins have no way of working with more than one open document at a time. It's an interesting idea. Please suggest this on Office Developer Suggestion Box. Or vote up one of the existing suggestions. A couple of possibilities:
Enable Excel to open a workbook in the same doc
Copy and paste ...
Related
I'm working with a list of addresses in excel 365. I want to perform a reverse geocode function to produce addresses from the available longitude and latitude info. to do this I have found an excel addin https://github.com/gramener/geocode-excel , which I downloaded. you can see an example in the screenshot above. the formula which it introduces is:
=#NominatimReverseGeocode(B32,C32)
Now what I want to do is make this available in my main sheet so that I can use the NominatimReverseGeocode. I've gone to File - Options - File - Add Ins
But the function 'NominatimReverseGeocode' does not show up in my main sheet. How can I make this function available in my main sheet?
EDIT:
I renamed the file to geocode.xlam in powershell. Now I'm getting:
If your intent is to make the Geocode functions available in all of your workbooks on your computer, do this:
Delete all previously saved Geocode.xlsm and Geocode.xlam files.
Download Geocode.xlsm.
Open it.
Go to File > Save As.
Change the file type from Excel Macro-Enabled Workbook (*.xlsm) to Excel Add-in (*xlam).
Click Save.
Close all instances of Excel.
Open Excel. (i.e. just the Excel application, so not opening a workbook.)
You should be on the Home screen.
Go to New > Blank workbook.
In the ribbon go to Developer > Excel Add-ins.
Check Geocode.
Click OK.
Close all instances of Excel.
Open any Excel workbook or make a new blank workbook.
Put =#NominatimReverseGeocode(51.5,-0.144) in any cell.
This should resolve to the Buckingham Palace Garden.
If your intent is to just have the geocode functions in one specific workbook, let me know and I'll write up the steps for that.
If you only need this code available for yourself and not other users by far the simplest way would be to create a personal macro workbook.
Create a workbook and save it as
C:\Users\username\AppData\Roaming\Microsoft\Excel\XLSTART\PERSONAL.xlsm
Copy the code from the GeoCode workbook into PERSONAL.xlsm.
PERSONAL.xlsm will autoload with Excel. Prefix your function call with the workbook name: =PERSONAL.xlsm!#NominatimReverseGeocode(B32,C32)
I have a very complex Excel workbook, with an awful lot of VBA code and macros in it. For version control purposes, I'd really like to be able to save the code as separate files to the workbook proper - to split it off into modules. Is this a thing that's remotely possible?
You should also look into Add-ins (.xlam). These allow your modules/class modules to be referenced in other workbooks. If you deploy a tool to a workgroup then realize that you need to change a macro you can update the .xlam and it gets pushed to all workbooks that reference it.
I am new to VBA and SharePoint. I have been researching a lot of different forums and help sites, but I still can't find what I am looking for.
I am using Excel 2007 I am trying to copy a Summary tab from different excel documents on a sharePoint site. The excel documents are in different folders and I am prompted for read only or Edit before the workbook opens. There are only 25 or so workbooks that I am trying to pull.
I would ideally like to pull the summary information from the different excel workbooks into one master excel sheet with each summary sheet having its own tab in the master excel document. I think I can write the code for that part it getting the information to the master excel document that I am not sure where to start. Any help or advice would be great!
You may want to look at JavaScript and make it to work with all browsers. Look at this library https://github.com/stephen-hardy/xlsx.js and the related site https://github.com/stephen-hardy/xlsx.js
I have a report that I run from a system once a week, and the data is exported into an excel document. I have set up the tool that exports the data to excel to do a decent job on formatting, but there is still more that I need to do once the data is in excel.
Is it possible to create a stand alone macro, save it in a Microsoft office folder and be able to call it after I open this file? I have written plenty of macros that are part of ONE given spreadsheet, but never tried one that was open to many spreadsheets.
IS it possible, and a starting direction of good resources of where I can learn how to achieve this goal? Thank you.
...and be able to call it after I open this file?...
You have 2 very good options
1) Write and save your macro to Personal file. See this link for more information
Topic: Deploy your Excel macros from a central file
Link: http://office.microsoft.com/en-us/excel-help/deploy-your-excel-macros-from-a-central-file-HA001087296.aspx
Quote from the above link:
Have you ever wanted to use that really handy macro in all of your Excel worksheets? You can. This column explains how to place your macros in a file called personal.xls and make them available each time you start Excel.
2) Create an Add-In
Topic: Creating an Excel Add-in
Link: http://msdn.microsoft.com/en-us/library/aa140936%28v=office.10%29.aspx
Quote from the above link:
You create a Microsoft® Excel add-in by creating a workbook, adding code and custom toolbars and menu items to it, and saving it as an Excel add-in file.
I have a reasonably complex macro that I need to run on multiple different excel sheets, this macro is updated periodically and whenever a change is made its necessary to change it in each individual excel sheet. is there a way to get each excel document to refer to the one macro?
for example if i had a hierarchy like this:
DOCUMENTS:
-xlsheet1.xls
-xlsheet3.xls
-xlsheet2.xls
MACROS:
-macro1.bas
where there was a button in each sheet that ran macro1 when clicked.
I would recommend either moving that macro to your personal file or create an Add-In
Working with Personal File
Topic: Create and save all your macros in a single workbook
Link: https://support.microsoft.com/en-us/office/create-and-save-all-your-macros-in-a-single-workbook-66c97ab3-11c2-44db-b021-ae005a9bc790
Quote from the above link:
When you first create a macro in a workbook, it works only in that workbook. But what if you want to use the macro in other workbooks? To make your macros available every time you open Excel, you can create them in a workbook called Personal.xlsb. That’s a hidden workbook stored on your computer, which opens in the background every time you open Excel.
Creating an Add-In
Topic: Creating Excel Add-ins
Link: http://www.ozgrid.com/VBA/excel-add-in-create.htm
Quote from the above link:
I am often asked by users 'what is the best way to distribute their macros?' My answer, is without doubt via an Excel Add-in. After all, this is what Add-ins are for. For those that are not sure what an Excel add-in is, it's is nothing more than an Excel Workbook that has been saved as an Add-in, File>Save as \ Microsoft Excel Add-in (*.xla). Once saved and re-opened the Workbook will be hidden and can only be seen in the "Project Explorer" via the Visual Basic Editor. It is NOT hidden in the same way as the Personal.xls as this can be seen (and made visible) via Windows>Unhide.
The Personal file is good for having a macro across any number of workbooks on a single computer. In a networked environment with multiple users, you could simulate the Personal file by having a single workbook with your macros in it and coding all other workbooks to open and hide this workbook when they start up.