I have currently written a sub, written in VBA, that is called by the click of a button on an excel document. The sub takes data in the cells of the document and sends them to a web service.
All of this works flawlessly when Visual Studio automates Excel.
I am wondering if there is a way to save this excel file to where it does not need Visual Studio to run. I want to be able to distribute the excel file to other people so they can use the web service with there own data.
Is this possible... If so how?
Thanks Alot!
Excel has a Visual Basic IDE built into it. You can press Alt-F11 to get to it or go to Tools -> Macro -> Visual Basic Editor. You can edit/add/write code here that will travel with the sheet you're working on.
To accomplish what you're looking to do, create a button in the spreadsheet. You can use the Visual Basic toolbox, which is accessed by View -> Toolbars -> Visual Basic. Create the button. If you double click that button while in design mode, the VB editor will be launched and it will take you to the code for that button. Paste the code you wrote into there and you'll be set. Your sub should look something like this:
Private Sub CommandButton1_Click()
' Code goes here
End Sub
Related
I'm trying to figure out how to do a VS2010 add in with gui, (like a simple popup with a few fields and an enter button)
I found stuff on stack that says Visual Studio (2010?) projects is what I need (instead of an addin) but all the tutorials I can find are for VS2008, and dont' apply to vs2010.
Is the answer outdated? what do I use?
Can anyone tell me what technology I need to use?
We have some powershell scripts that take parameters and generate code for us, I want to click on a menu item under tools (or a tool bar button) popup and ask for the parameter values, click ok, and then run the powershell. (someone else wrote the powershell, i just want to creat a built in gui for them)
As a bonus I'd like to add resultant files to the projects, but that's down the line.
Any hint or tutorials you can point me towards would be a great boon.
I want VS2010 to ask me when I am closing the whole environment whether I am sure about closing VS2010 or not.
Unfortunately I couldn't find this setting anywhere
Anybody knows?
AFAIK, there is no such option. However, there is an old tool called NoClose that can disable the (X) button for you (see LifeHacker article about this tool)
Though I haven't used it under Windows 7/8, I'm not sure if it is compatible.
I haven't tried this in Visual Studio 2010, but you can achieve this in Visual Studio 2008 at least by using an Automation Macro. The instructions below work for 2008, and shouldn't be too hard to translate to 2010 (hopefully).
Open up the Macro IDE (Tools->Macros->MacroIDE), and in the list of Macros you should see an item EnvironmentEvents. Double-click this to get a module containing the existing Environment Event macros.
In the drop-down list select SolutionEvents, and then in the Declarations list select QueryCloseSolution. What we're doing is creating a macro that is run whenever you try to close a Solution. We'll create a messagebox to ask the user if they really want to do it, and optionally cancel the shutdown - you should end up with something like this:
Private Sub SolutionEvents_QueryCloseSolution(ByRef fCancel As Boolean) Handles SolutionEvents.QueryCloseSolution
If (MsgBox("Close the solution?", MsgBoxStyle.OkCancel) = MsgBoxResult.Cancel) Then fCancel = True
End Sub
Save the Macro project, and try closing the solution, or shutting down Visual Studio. If the stars are aligned you'll see a confirmation message box. If you click "Cancel", the solution won't close, and VS won't shut down.
Now, perhaps someone can confirm in the comments if this works for VS2010?
I want to extend Visual Studio such that, when someone right clicks on Solution Explorer, context menu should have a new menu item, say "Open custom form", clicking which should open a form (this form would actually accept some settings and modify config file accordingly)
Q1. Please provide on where should I start for such extension. Couldn't find any reference/tutorial link :(
Q2. What technology can be used to make such a form - Winforms/WPF?
Either Windows Forms or WPF should be fine.
SO: Visual Studio Add-In - adding a context menu item to solution-explorer
Google Code: explorer-popup-add-in
There's a lot of docs on Visual Studio integration here
Which version of Visual Studio Express should I use to develop an HTA application that will script Word and Excel and connect to a web service?
Should I download the web edition because hta files are like web pages, or should I download one of the others because hta files work on the local machine? Or is there another IDE I can use?
SharePoint Designer 2007 which is now free to use. FrontPage 2003 if you already have it. I feel that FrontPage/SharePoint HTML editing is awesome, especially the VBA support during design-time editing. When you want to view the HTML Application, just press F12.
Visual Web Developer Express will also work well. Note that Visual Studio 2008 versions use "SharePoint Designer 2007" as the HTML editor. Even though Visual Studio uses the same HTML editor, the editor user-interface is much better in SharePoint Designer 2007 or FrontPage 2003.
To debug see the below reference.
Debugging VBScript and JScript in vbs, js, wsf and hta files at http://myitforum.com/cs2/blogs/maikkoster/archive/2009/03/25/debugging-vbscript-and-jscript-in-vbs-js-wsf-and-hta-files.aspx
Microsoft Visual Studio: Editing HTA files with VS2005 - debugging at http://msdn.itags.org/visual-studio/30906/, but use the Stop (VBScript) or stop; (JScript) statements instead of a message box statement.
HTML Applications at http://msdn.microsoft.com/en-us/library/ms536471.aspx.
Extreme Makeover: Wrap Your Scripts Up in a GUI Interface at http://technet.microsoft.com/en-us/library/ee692768.aspx
HTML Applications (HTAs) provide a way for you to wrap your scripts up in a graphical user interface, an interface replete with check boxes, radio buttons, drop-down lists and all those other Windows elements you’ve grown to love. In this article, the first of a multi-part series, we’ll introduce the basics behind creating your very own HTA.
HTA Helpomatic at http://www.microsoft.com/downloads/details.aspx?FamilyId=231D8143-F21B-4707-B583-AE7B9152E6D9&displaylang=en
Utility to help script writers create HTML Applications (HTAs).
Go into Notepad, Internet Explorer or most other applications that display or edit text. Triple click on some text. Windows will select the entire paragraph under the cursor.
This doesn't work in Visual Studio 2005.
How do I get triple click support in the Visual Studio text editor?
do VS 2008 or VS 2010 solve this?
Is there a macro, setting or plugin that will solve this?
I wrote an extension for this for Visual Studio 2010 that you can download from the VS Gallery or directly from the extension manager in Visual Studio, by searching for "triple click" or my name.
You can also read the blog post I wrote about it and check out the source, on github.
I haven't used it, but CodeProject has an article on SmartHelp 3.04 which mentions that you can triple click to select a whole line.
Also, from Craig Shoemaker's blog.
About VS 2010.
Further enhancements include the
ability to triple-click an expansive
element like a table and the editor
selects the entire table’s markup.
Want to surround that table with some
additional markup? Just start typing
with the table selected and your
markup is inserted around the selected
code.