Excel, vba, and onedrive or sharepoint file sharing - vba

I have two local excel files on my hard drive. Both have Macros to achieve certain goals. But after all being done the end result is that after i click a command button from one excel file (lets call it 'A') the data gets transferred based on a macro behind that command button to the other file (let call this one 'B') in a certain format.
All this works great. The source file 'A' is accessible by everyone to enter data, but the destination file to maintain data integrity is read only but a macro is able to write into it. For obvious reasons, both file are on a shared folder so data can be entered one file and transferred to another by everyone.
Now I want to be able to continue with the same functionality but now on a sharepoint or onedrive. Unfortunately I am unable to do so.

I am not sure what are your exact requirements, however I think you can use SharePoint lists with SPD workflows to meet your requirements instead of using excels.
Whenever business users need data in excel they can always export them from list.
There is one more easy way where you can let users enter data in excel however it will be stored in SharePoint list.

Related

Building an engine in Pentaho

Basically I want to create an engine that reads in all data sources and pushes them out. I'll need to use a flag to turn applications on and off and a sequence column to adjust which is running first. It will be a file based repository.
Does anyone have any useful ideas or links on how I would go about doing this?
I am reading in an excel file with applications as the field.
I have copied rows to result, but i want to output multiple excel files with each application name as the name of the excel file. So each row would become the name of the excel file
Not sure how to do this?

Interactive editable spreadsheet in Google Docs

I have created a spreadsheet in google docs. The spreadsheet takes some input, calculates some results, and displays the results numerically but also as a graph.
I would like to publish this spreadsheet, so that anyone can input and get the results and the graphs. I tried the Publish to the Web option (from File Menu), but the spreadsheet becomes static (no calculations possible on new values)
I tried the Share option. However when choose anyone can view the spreadsheet is not interactive. When i choose the anyone can edit option the file is usable, but my concern is that if I publish this on the internet and 2 users want to calculate simultaneously based on different values it will mix things up.
Is there anyway to accomplish what I require without setting up a website or programming in Javascript? I do not need to protect any of the calculation routines, I only require that the spreadsheet starts everytime with the default settings, the edits are not saved and the spreadsheet is interactive.
Seems like you may want to publish your Google Sheet as a template. Doing so will let strangers "deploy" a copy of your spreadsheet, for their own use (and without conflicting with other web users).
Google Docs template gallery
Instructions for submitting a template
Caveat: Until Google adds support for publishing "new" Google Sheets as templates, you'll likely want to submit a spreadsheet in the "old" format.
I might suggest using Protected Ranges.
https://drive.googleblog.com/2012/08/lock-down-cells-with-protected-ranges.html
Basically locked cells and you should be the only one able to manipulate the locked cells to you can freely set the page to be editable.
You can also specify the Range of cells that you wish to use when embedding. (See the publish options).
These two methods should help you with your project.

VB.net text -> Excel conversion (with extensive formatting required after conversion)

I'm creating a program in VB.net that does the following:
At a high level I receive a file in email, put the attachment in a monitored folder, import the text file to excel, format the excel, and then email the excel file to a list of recipients.
Here is my plan:
Completed: Outlook VBA to monitor all incoming email for specific message. Once message is received drop attached .txt file in a specific network folder.
Completed: (VB.net) Monitor folder, when text file is added begin processing
Not Complete: (VB.net) Import text file to Excel
Not Complete: (VB.net) Format Excel Text file. (add in a row of data, format column headers with color/size, add some blank columns, add data validation to some of the blank columns that allow drop down selections)
Completed: (VB.net) Save file.
Completed: (VB.net) Send file to list of recipients.
Obviously the items above that are not complete are the bulk of the work, but I wanted to get some advice on what some of you think would be the best way to approach something like this. The import and formatting of the file are causing me some problems because I just can't decide what would be the most efficient way to do this.
What I've thought of so far:
The way stated above. Import to excel -> format
Having a template excel that contains all of the formatting already done for me and attempting to transition the data to this document (no clue if/how I can do this). Is it even feasible? Have the template already created and then import the text file to a new excel file, then transition that data to the excel template?
Something I thought about, in terms of formatting the document, was to record a macro of me doing all of the formatting that I'm going to need and then attempt to convert that macro into my vb.net code, but I'm not sure if that will work. I will need to verify that the text file comes in the EXACT format every time correct?
I really appreciate any advice/suggestions that anyone is willing to give.
You will want to use http://epplus.codeplex.com/
It allows you to create an Excel file from scratch, without having to start Excel itself. Automating Excel will make the process slow and it lacks robustness (Excel process can hang or not close properly).
In addition, using a .Net library allows you to run it on a server or so where no Excel is installed. (Next step would be to inspect the mailbox via POP, IMAP or the Exchange API, so that part doesn't have to be run on a client machine either)
http://msdn.microsoft.com/en-us/library/kh3965hw(v=vs.100).aspx
You can also just use the Interops from MS to interact with Excel, Outlook, Word, etc. They're not difficult at all to use. I'm not familiar with CodePlex, so that may be a better route or an easier one. I just wanted to provide you with an alternative.
With Microsoft Office 2010 Interops you can not generate Office files from .net applications anymore.
You can manipulate data from existing Excel files so you need templates(your 4th point). Then Excel allows you to query some databases. You may be able to simulate one with your folder, otherwise I suggest to convert your .txt files into some databases. (3rd point)
If you do use an older version, you can crate your Excel files by loading them into an instance of Excel and manipulating them as you wish.
By the way I supposed your attached files would have some sort of format.
If you want to manipulate Excel files, I can recommand you the NPOI library found on CodePlex. It has several advantages over OLE-automation:
NPOI is not dependent on a specific Excel version.
Excel (or any other Office component) need not to be installed.
It is faster.
It works with both .XLS and .XLSX files.
We are using a third party software called excel writer. May not be what you are looking for becauseit needs to be license, but it is very fast and the clients does not have to wait for a chart or a data output. Because we have that tool, have not try anything else.

How to read changes in excel file into vb.net application

I have an excel file which is auto generated by third party software..and its readonly file and its data constantly keep changing online.
now i want to use or read that data in my vb.net application whenever its changes take place in excel file automatically.
please help me..
Cody's right. No question, but I'm guessing you're looking to do something along these lines.
First, you'll need to pull down a copy of that XLS file (sounds like it's online at a website somewhere). To do that, you'll need to perform a pretty normal HTTP get or use whatever API the website provides to pull the file down.
Save the file locally, then open it and read it using EXCEL AUTOMATION. Just google excel automation for loads of examples of opening a worksheet file, reading cell values, and closing the file.
There's other options too such as the OpenXML api from Microsoft to allow you to read the contents of XLSX files directly without using excel automation, so that may be a possibility. not enough in the original post to know which would work best for you.

VB - Automated Excel in Visual Studio 2010 - Selection Changed Question

I am currently writing an utility that takes two different sets of data from an excel document and sends it to two different web services. Each set of data has it's own button that sends the data to the web service. When the a button is clicked, the corresponding web service then returns data depending on the input values.
What I am trying to do is so that this utility can be distrobuted and used by a wide variety of people. What they are going to do is they are going to be synchronizing there particular cells of their own excel document to the corresponding cell in my utility. Using simple excel formulas. For example:
c:\temp\[book1.xls]sheet1'!a1
Now what I am trying to do is automatically "click" the button, or update, on my utility when the user links their cell to its corresponding cell on my utility.
I have tried the selection change event on my page. But it doesn't actually process until my utility is active, or clicked on.
Is there a way to make my utility automatically update? It would be especially awesome if somehow it did this while my utility was closed. So when the user opens it it is already filled with their information, and the outputs are correct.
The requirements:
you need to guarantee that when a user is using excel your app can collect the data. Your app may not be running at the time. You need the Worksheet_SelectionChange() event to fire automatically not just when your app is active.
Solution:
Basically in order to guarantee that the Worksheet_SelectionChange() is running all the time, and in order to guarantee that whenever the user opens an instance of excel you are able to collect and process the data/formulas entered into the particular target range address you need to wire up the selectionchange event inside of a VB.NET Excel COM Addin. There are several ways to do this, but since your using VB.NET your best off using the newest approach which is building a VSTO COM Addin.
There are numerous other questons available on how to best build a VSTO addin (some in C# some in VB.NET but all this information is exactly the same for both, just different syntax).
So you will need two projects. Your existing one, plus a Excel VSTO addin (which you can also do in VB.NET).
Now inside the selectionchange event you should make sure that your code handles the target range correctly; ie. make sure you check for non-contigious groups of ranges with a selection... A1:B1;D2:E2 and copy the data to your app. You may consider using a format such as xml to serialise the latest data from excel so that if your app is not open at the time, it can deserialise and read back the data stored for it the next time it is opened. I guess it really depends how your handling the data (i.e. is it for loading into a datagrid?) and whether you are going to do further processing and store it somewhere else later (in which case maybe you can put it straight into a database from the addin in excel).