TFS Excel Add-In: Change Query Source Programatically / Macro - vba

I would like to change TFS Excel Add-in List Query programmatically using excel macro.
I have requirement to provide bulk edit work items functionality using ASP.Net Web Application. I am planning to create pre-defined excel template (Bind with Empty TFS Query) and copying it to web server. I am creating TFS Query programmatically based on user input (work item id) and downloading this template file on client when user request "Bulk Edit" functionality. I want to run macro which will update TFS Excel Query and refresh list pragmatically. I tried sample app to refresh TFS Excel list (https://blogs.msdn.microsoft.com/team_foundation/2010/11/06/programming-for-the-tfs-excel-add-in/) which is helpful but I would also like to change "List Query". I also tried accessing TFS Excel custom properties to change connection string or query but not sure which property and how? I need input for following items
Change TFS Excel Add-in List Query programmatically using excel
macro OR
Update TFS Excel Custom Property to update Server / Query
name and refresh list

Well, there really is no supported allready prepared way to do that. Here is the official doc from MSDN: https://www.visualstudio.com/en-us/docs/work/office/bulk-add-modify-work-items-excel

Related

Call Function via User Interaction with Office Scripts in Excel Online

Is it possible to trigger an Office Scripts function within Excel Online as a result of a user action? For example, can I run a specific Office Scripts function when the user clicks on a hyperlink within Excel Online? If so, can you give an example of the syntax/setup of the hyperlink?
It is not possible to trigger based on user-action; we are investigating allowing trigger through a shape/image (button). Would that be something that'll meet your requirement?
(I work on the product team)
You could try building a Flow (aka "a Power Automate") that is triggered on the "File Change event"(for the Excel file) in SharePoint. Instead of just having the Flow trigger on double-click you would need to enter data into the cell. Because the worksheet and, this, file changed the Flow would trigger. Good luck.

Fetch data from Rally in Excel Macro using vb script

I want to get data like Workspace,Projects,Sub Projects,Releases etc from Rally in excel Macro
I am able to connect to Rally but I Need code in VB scripts to get the Workspacelist and selecting a workspace project list, upon selecting a project sub project and then release.
There is an excel add-in that makes it very easy to query data from Rally and pull it into sheets in excel. Are you using that? Once the data is in there it should be straightforward to manipulate in VB. We don't have any existing tools for doing this natively in VB though.

How do I upload an Excel sheet to a SQL table in a Lightswitch web client?

I have a lightswitch project in visual studio 2013, using vb.net. I would like the user to be able to click a button and have lightswitch find an excel file, and upload that file to a sql table according to a pre-determined column mapping.
My preference was to use the Office Integration extension for visual studio, which I got working with VS 2013 by downloading it from this link: http://www.ge.tt/71iuRQv/v/0
However, the documentation and examples for office integration seem to be very heavy on getting an excel spreadsheet into a display in the lightswitch web client, rather than into the sql data table, which is where I need it. Here are the examples I've been following:
http://blogs.msdn.com/b/bethmassi/archive/2012/07/18/new-and-improved-office-integration-pack-extension-for-lightswitch.aspx
Alternatively, I have an existing stored procedure, and I can request that the server call this stored proc by sending a web API extension from the client to the server. I have this working already for other stored procs, according to examples from Beth Masi and Paul van Bladel. (Stackoverflow won't let me post the links...)
The undesirable part of this approach is that the stored proc is old, and messy.
I've searched and searched, but have yet to find anyone approach this problem for VS 2013 with lightswitch. Any useful advice?
I've used the method detailed by Matt Sampson to store word files and it works very well. Since it just stores the raw binary it should handle Excel files just as well.
If you're creating the table in LightSwitch, use the Binary Type. If you use SQL create scripts use varbinary(MAX).
You need to create a custom Silverlight dialog box to gain access to the OpenFileDialog object. Then open the file in as a FileStream.
Finally, you need to add a handler for the closed method of the control and then show the control to the user. Most likely done in a button. This needs to be done on the main dispatcher.
The code examples are in C# but I just used one of the many available translators out on the web and copy/pasted the VB.NET code.
Another option might be to consider shelling out to the DTSEXEC run-time to execute an SSIS package to perform the upload - especially if the target Excel spreadsheets have predefined layouts and content data types.
Even simpler, you might be able to use the SQL Server BULK INSERT command to get the job done - although that would require a SQL Client connection to your database.
HTH

Creating Spreadsheet from SQL using ASP - Can I attach macros?

So I have been using ASP for all of a week now and perhaps this is something that I just can't do, but I am trying to dynamically generate reports from data stored in a SQL database. I am publishing the reports through an ASP document and displaying by specifying Excel for the MIME content type:
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
Is it at all possible to "attach" macros to the document? I understand I can do basic formatting in the HTML, but I would prefer to import the desired database data and handle it within excel via macros.
EDIT:
I have several reports I need to generate but for one example:
I want to load retrieved data from the database into a sheet in excel.
Attach Macro
Begin Macro:
Hide the specified sheet.
Programatically create new sheets for categories of data.
Format sheets.
The question is not about how to program the macro, just whether or not a macro can be attached and how to achieve this. In regards to alerts upon opening the sheet, if I can attach macros I should, theoretically, be able to suppress those in the Open Workbook event.
EDIT: I believe I can achieve the desired result by using OWC (Office Web Components) (see http://support.microsoft.com/default.aspx?scid=kb;EN-US;288130). However, I am not sure if I will be able to install it on our Web Server. Any other suggestions?
While it is possible in a strictly technical sense, it is neither simple nor advisable. The recipient of the sheet will get multiple prompts related to the security of your macros; the source of your macros; and if they really, truly, honestly meant to click to enable macros...

Writing data back to SQL from Excel sheet

I know it is possible to get data from a SQL database into an excel sheet, but i'm looking for a way to make it possible to edit the data in excel, and after editing, writing it back to the SQL database.
It appears this is not a function in excel, and google didn't come up with much usefull.
If you want to have the Excel file do all of the work (retrieve from DB; manipulate; update DB) then you could look at ActiveX Data Objects (ADO). You can get an overview at:
http://msdn.microsoft.com/en-us/library/ms680928(VS.85).aspx
You want the Import/Export wizard in SQL Management Studio. Depending on which version of SQL Server you are using, open SSMS (connect to the SQL instance you desire), right click on the database you want to import into and select Tasks.. "Import Data".
In the wizard, click Next (past the intro screen) and from the Data Source drop list select "Microsoft Excel". You specify the path and file name of the Excel spreadsheet, whether you have column headings or not.. then press Next. Just follow the wizard through, it'll set up the destination (can be SQL Server or another destination) etc.
There is help available for this process in SQL Server Books Online and more (a walkthrough) from MSDN.
If you need something deployable/more robust (or less wizard driven) then you'd need to take a look at SQL Server Integration Services (for a more "Enterprise" and security conscious approach). It's probably overkill for what you want to accomplish though.
There is a new Excel plug-in named "MySQL for Excel" : http://www.mysql.com/why-mysql/windows/
I just had a need to do this, and this thread has been quiet for a long time, so I thought it might be useful to supply a recent data point.
In my application roving salespeople use a copy of an Excel workbook that tracks the progress of a prospect through a loan application. The current stage of the application needs to be automatically saved back to a remote SQL database so that we can run reporting on it.
Rejected methods for updating the database from Excel:
SSIS and OpenRowSet are both methods for allowing SQL Server to pull the data from Excel, and don't work very well when the Excel workbook is sitting in an undefined location on a user's computer, and certainly not when the workbook is currently open in Excel.
ADO is now, if not actually deprecated, nevertheless looking very long in the tooth. Also, I wanted the solution to be robust in the face of the user possibly not being connected to the internet.
I also considered running a web API on the destination server. Macros in the Excel workbook connect to the web API to transfer data. However, it can sometimes be painful to allow a web API to talk to the outside world. Also, the code to make it robust in the face of temporary loss of internet connection is painful.
The adopted solution:
The solution I plan to adopt is low-tech: email. Excel emails the data to an address hosted on an Exchange server. Everyone in the company has Outlook installed, so the emails are sent by programmatically adding them to the Outlook Outbox. Outlook nicely handles the case when the user is offline. At the server end, a custom C# executable, fired up at regular intervals by the Task Scheduler, polls the inbox and processes the emails.
You could use try these add-ins :
www.QueryCell.com (I created this one)
www.SQLDrill.com
www.Excel-DB.net
You can use the OPENROWSET function to manipulate Excel data from a T-SQL script. Example usage would be:
UPDATE OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'Excel 8.0;DATABASE=c:\MySpreadsheet.xls',
'Select * from MyTable')
SET Field1='Value1' WHERE Field2 = 'Value2'