How to read Excel worksheets into datatables - excel

I'm trying to solve this problem that I have in my application.
I'm doing a add-in excel for excel, and I've never done it before.
What I need to to do is open an excel file in excel and then I need to use Globals.ThisAddIn.Application.ActiveWorkbook
to access the workbook and retrieve the data from 4 worksheets into a datatable.
No connections with constrings, I have to work directly with the open book.
I've been working on this and getting nowhere.
Any help or pointers would be appreciated.

I managed to solve it on my own, which is great.

Related

Excel workbook creating undeletable sheeets during execution

I'm getting more and more Sheets in my workbook?
Does anybody know how I delete these additional sheets?
I'm running excel 365 and the file is located on a sharepoint.
Any help is appreciated.
Ok. I haven't had any luck regarding this issue. However, I found others dealing with the same issue. The solution I came up with might help, and is quite simple:
Save the document as a xlsx file. This deletes the phantom sheets. Then manually transfer forms and macros and save the document as an xlsm file. Not a pretty solution. But it works.

How to copy data between two Excel workbooks?

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 ...

How to loop through all opened workbooks in the Excel Javascript API?

I'm trying to switch from VBA to new Excel Javascript API, but I cannot find analogue to VBA collections and methods to loop through all opened workbooks.
Usually in VBA I was able just write something like this:
for each i in workbooks
next i
using workbooks object
or just call opened workbook by name or index
workbook(index/name of workbook)
So, in JS office I found only something similar to VBA function 'workbook.open' JS -document.getElementById("file"); in this article and this article has no mentions at all
I've tried to find something about 'Office.context.document' in Google and in in official repo, but all links have 404 error.
Does anybody knows how to solve this problem?
Thank you for your help!
I'm afraid that there is no Office JS API right now that can get a reference to an opened Excel workbook other than the one the add-in is running in. But it is a good idea. Please vote up this suggestion at the Office Developer Suggestion Box.

Add VBA code to all worksheets for ALL excel workbooks in a folder?

I searched but could not find any topics on this specific use case.
I have developed code that I want to implement on multiple (>100) different excel files and was wondering if there is a way using VBA or other to add the VBA code to ALL worksheets in ALL excel workbooks in a specific folder.
In addition, I will need to enable Microsoft Internet Controls reference in all as well.
Thanks in advance.

How to put design in Excel spreadsheet/s using VB6

How can i put some design in excel spreadsheets? like the photo below
I am using VB6 here. Thank you in advance.
You may try this,
Use Record Macro in Excel to record the steps you formatting in Excel. Then open the Macro you recorded in VBA. From there you should find the clues on how to do this in VB6.

Resources