How to install a theme color in vba - vba

I just downloaded a color theme on that link (a vssetting file) and would like to know how to install it in VBA.
I have the file but no option to put it into VBA. How do I do that?

You can't use a .vssetting file, that's a Visual Studio thing - the VBE wouldn't know what to do with it.
Its colors are "configurable" through the Tools > Options menu; they're the same rather limited 16-bit colors from 1997... and there's no file you can import that will make a "theme" (a .reg file could act like it, perhaps)
There is a hack, though - you can hex-edit VBE7.DLL and change the available colors to whatever you like. Obviously the risk is that you completely wreck VBA in every single VBA host application at once, but hey shiny colors are worth it eh?
The only thing I'm seeing that's remotely close to "theming" the VBE (and doesn't involve rewriting VBA itself) is what we want to achieve in Rubberduck (an OSS VBIDE add-in project I manage) by version 3.0 (we just kicked off the v2.1.x cycle), when we inject our own AvalonEdit WPF code pane into the VBE, implement our own IntelliSense and take full control of the VBE code panes' appearance and functionality - but there's a lot of work to be done before we can even dream of shipping that wet dream of a feature - so if you know a bit of C# and WPF, by all means join the Rubberduck dev team and help us do it!

Related

Visual Studio - Opening a control reorganises designer.vb

Just wondering if anyone knows the answer to this one. I am running VS2015, and some colleagues are running VS2013. We are all running our code through TFS for source-control, and we encounter this issue quite a bit.
When we open a form or a control, not even modifying it, then close it, it will completely restructure the *.Designer.vb file, but not modify any data (at worst, it's simply put the upper casing of True/False to true/false).
This proves an issue as we are becoming increasingly wary of working on the same forms as one another.
Does anyone know a potential fix to this, or if this is a bug of sorts?
Thanks!
The VB code use PascalCased keywords.Even though you write the keywords in lower case and VS would auto-casing to PascalCase.
However,there is a way to change to Lowercase Keywords:
Download Glamour from the GitHub repo.
Install it by drag/dropping the truetype font (.ttf) files in your
%SystemDrive%\Windows\Fonts folder.
Change your text editor font in the Tools > Options > Fonts & Colors
dialog to Glamour.
Select "Keyword" in the "Display Items" list and check the "Bold"
checkbox.
Finally you got this as below:
This method is referenced from Anthony D. Green's Blog. More detail: http://blogs.msdn.com/b/vbteam/archive/2015/04/02/lowercase-keywords-revisited.aspx?PageIndex=1#comments I was wondering anyone of your team are using the lowercase keywords cause this.

How to google from the context menu of the Visual Studio 2015 code editor

how can I modify Visual Studio 2015 to be able to search the internet (my fav search engine happens to be google) from the context menu in the code editor?
Ideally, I would like it to open as a new tab in my (default) external browser, because the internal web browser is still...lacking, shall we say?
I found one extension "web search" for older VS, but I have found no extension that works with VS 2015. I found no article that still works.
For comparison, when you're in Chrome, you can select some text, right click and say Search Google for 'what you selected'.
I think this would be handy when learning new technologies from a project that uses those technologies, or just for help.
Ok this turned out to be fairly easy. I just added a tool to Tools, External Tools
Command: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
Arguments: https://www.google.com/?gws_rd=ssl#newwindow=1&safe=active&q=%22$(CurText)%22
I enclosed the $(CurText) variable around quotes (%22) so that it would search on the exact phrase.
Then, to make it more accessible and actually put it in the context menu (and other places), I clicked the Move Up button to make it the first command, then customized the Standard toolbar to include Tools.External Command 1. I also added it to Other Context Menus | Html Context and Editor Context Menus | Code Window
Then I also went into Tools, Options, Keyboard and associated Tools.ExternalCommand1 with Alt+G
IMPORTANT: Because Visual Studio (still, in 2015) doesn't save some modifications to the IDE until it shuts down, you need to shut down all other instances of VS and then lastly shut down the instance that you used to enact these IDE modifications for them to "stick". And, if VS 2015 is like previous versions, be prepared for the menu / toolbar modifications to simply go away one day, at which point you'll just have to redo them.

Is it possible to write Excel VBA Code in Visual Studio

Is there a way to write VBA Code in Visual Studio. If not is there any other alternatives?
The best you can do is bend the office Visual Basic Editor (VBE) tool to your liking. If you stay in it's native environment you get the full power of error detection, Intellisense, live code running, etc.
My tips...
In the VBE go to Tools > Options > Editor tab.
Turn off 'Auto Syntax Check'. You still get code highlighted errors but no annoying popups.
Go to the Editor Format tab and change the Font to Consolas (Western), Size 11.
For code indenting install the awesome, free, Code Manager. It adds some sick keyboard shortcuts.
Make the Edit toolbar easily accessible for code commenting/uncommenting.
Use Rubberduck to add unit testing, source control, code inspections and refactoring functionality.
With those simple changes you end up with a half way decent, useful, and keyboard friendly environment to write your visually appealing code. :-D
VBA code for Excel can only be written inside Excel using the VBA IDE. VBA projects are stored as part of the Excel file and cannot be loaded into Visual Studio.
However, you can write VSTO (Visual Studio Tools for Office) managed add-ins for Excel using Visual Studio. The following MSDN page covers both developing with VBA and VSTO.
Excel for developers
You could also use the interop features of VBA to consume a (COM) object written in Visual Studio from your VBA code.
I've been looking for an answer to this question myself.
Best I've found myself is the option of exporting a Module ect from Excel with the code you've already written (or blank) and load that up in the Visual Studio Environment.
It doesn't offer much, but the highlighted text and auto indenting is nice and makes it much easier to read compared to the standard VBA environment.
Then once you're done just import it back into Excel.
There is a VSCode extension to do this.
It allows you to write code in VSCode and export it to Excel.
This extension is very useful when you develop in VBA.
Here's the link to download the XVBA extension
Edit :
As Peter Macej said in comment, this solution only works for Visual Studio Code not for Visual Studio
You can certainly add and edit a VBA file (.vb) in your Visual Studio solution, but the intellisense will be worthless/screwed up.
This extension for VScode would probably provide a much better experience: https://marketplace.visualstudio.com/items?itemName=spences10.VBA
If your goal is have your VBA code exposed to source control so you can track changes, then it's still worth it to include in your Visual Studio solution, but just store that VBA code in a plain text file and then use the Excel interop to load it into the appropriate module within the excel workbook, e.g.:
xlWorkbook.VBProject.VBComponents["ThisWorkbook"].CodeModule.AddFromFile(#"C:\PathToYour\VBAcode.txt");
And there are other methods to delete/replace code lines, etc....
You can try xlWings package for python and use it with VS Code https://youtu.be/xoO-Fx0fTpM

Looking for a simple rich-text editor usable from VBA

I'd like to allow my users to enter rich text (with bold, italic & underline, but probably nothing more than that) in an entry box on a VBA userform.
I don't want the user to have to install anything, so I need this to be something that leverages what Office or Windows already provide. The obvious candidate is the Windows built-in Rich Edit control.
I did a quick test and verified that I could create a window of this type from VBA, but what it then lacks is all the UI, etc. I could really use a leg-up as to how I then turn this into something usable.
I'm happy to consider alternative controls, so long as they're guaranteed to require no installation (other than as part of the Excel file containing the rest of my VBA code). It needs to work on Windows XP and up, and Office 2003 and up.
You could just try making a simple UI yourself. Add a command button to the form that will bold the selected text in the rich edit control. Or add a command button that will italicize or copy or paste. Your imagination is your limit.
I was checking Rich Edit Version 1.0 in Excel 2010, and I could access the text in the control.
For anyone searching for this still. As Gary McGill stated, "Microsoft InkEdit Control" is your best option.
Use the link below for a reference on the variables it can use:
https://www.thevbprogrammer.com/Ch10/10-06-RichTextBox.htm
With the Toolbox window open in Excel's Visual Basic editor, select Tools->Additional Controls from the menu. Check the box next to MSREdit Class. This will add the rich text control to your toolbox. From there you can add it to a UserForm.
I tested this control in both Office 2003 on Windows XP and Office 2010 on Windows 7. It looks like you'll still need to provide the UI for allowing the user to toggle bold, italics and underline.
It does accept a paste (via Ctrl+V) of some rich text that I copied from Word, but I couldn't figure out how to make it switch font formating while typing text into the control.
Putting this here just to rule it out...
It seems that the "Microsoft InkEdit Control", which is available from "Additional Controls" on the toolbox, is a superset of the Rich Text Edit control (as the name suggests, it also supports Ink).
It's hard to tell whether this is widely installed - it is on my XP/2003 machine, but not on my 2K/2K machine. (I've seen it said that it's installed with Vista and Win7, but clearly there are earlier versions too).
Anyway, I'm ruling this out because using the control results in a message at runtime to the effect that the ActiveX control is "unsafe" (presumably related to the well-known issue with the Rich Text Control itself).

VS 2010 Floating code window NOT always on top

Most of the time when I code, either using Visual Studio or gVim, I like to have many open windows with code files so that I can go back and forth from one to another, either to edit or just read while editing another file.
Thus I found VS 2010's feature of "floating" code windows very helpful. However, the fact that when a code window is floating, it's "always on top" is a bit annoying, because it might hide other windows, such as the "Find Results" for example.
Is this something that is customizable? Is there a configuration value somewhere that either enables or disables the "always on top feature" of floating code windows in Visual Studio 2010?
Thanks
Well, it is not a real top-most window, it is merely on top of the Visual Studio main window. An 'owned' window. From where it competes with other windows that VS displays for the Z-order, like the Find Results window. You'd need to arrange these windows so they don't easily overlap and obscure each other. That's supported, you can dock them. Bit of a chicken-and-egg problem, isn't it?
If you have concrete ideas how to improve this then you can post them to connect.microsoft.com