Is there a way to change the VBA editor's own font? - vba

In the red range, the font is different from the system font. The system font is Microsoft YaHei UI, but these parts of the font is SimSun.
Is there a way to change these parts of the font?
Or is there a way to beautify the VBA editor? VBA editor is not pretty.

Check out [Tools] -> [Options] -> [Editor Format] - in there you can set the fonts used for various elements of the VBE.

I have an alternative solution.
VBA editor is ugly and doesn't have good intellisense. In addition, VBA is not fast.
These are reasons to prompt me to use Python+xlwings.
When I can use Python, beautiful editor UI and good intellisense I can get easily.
The most important, Excel operations will be faster.(numpy, pandas, etc can be used)
I am using xlwings to make Python operating Excel.
From the pictures, do the same operation to Excel, Python+xlwings only need 4s, but VBA needs 31s.
So if someone can use a little Python, I recommend using Python+xlwings to operate excel.

The VBA editor UI is based on Windows system fonts. You need to edit the windows registry keys to make the required changes, see How to change the default font in Windows® 8.1

Related

How do I style a word document exported from a webpage in VB.Net

I'm trying to export text retrieved from a database into a word document in VB.Net and while I have a working example, I need to figure out how to style some sections of the document appropriately.
I have found a few working examples from MS Online resources (such as this one), which I've found can cover some basics:
para.Range.Text = "Quad Chart"
para.Range.Style = "Heading 1"
para.Range.Bold.Font = True
But it doesn't cover even some of the simplest of formatting such as:
How you align the text (left, right, center)?
How you specify letting?
How do you start a list style?
What I'm trying to find is either a straight answer to these or (even better), a definitive list of the commands that would allow most any formatting.
Also, I would prefer not using Spire, which seems to be a common answer.
Thanks!
The VBA object model describes all the classes, their methods and properties that you can use for the marking up of content.
Your suggestion to use styles is strongly recommended as a way of separating your code from the presentation. Create a document template (.dot or .dotx, depending on Word version) and attach this to your documents. Then, when the document is opened, it will inherit layout and presentation from the template and be correctly rendered.
The list creation is a little intricate as you will need to restart the list if you are using numbering.
If you are interested in a completely different approach, you can look at Applying an XSLT Transform in the Microsoft Office Word 2003 XML Software Development Kit. This describes how to generate XML documents and using XSL transforms to describe the presentation. More general, but definitely more complex to set up.
Your preferred approach will depend on whether you want to generate native documents with a template, or to require your users to install the transform using the tools in the SDK.
So, you have a few examples. Office VBA is a cut down version of VB6, so why not record some macros in Word, open the VB editor and look at what it does. It's also the easiest way to navigate the help on the Word object model.

Dreamweaver's Code Editor, highlight

I am new to Dreamweaver (and Mac). I am used to using notepad++. I am in the habit of highlighting a term, and having identical terms highlighted everywhere in the current document. Can this be done with Dreamweaver? If it is not possible to do this with Dreamweaver, then what code editor will do this on a Mac?
Try http://www.barebones.com/products/textwrangler/.
Or maybe try using eclipse, it might be a bit of overkill, but then again I have no idea what are doing in the dreamweaver.

How to set initial view options for PDF documents (exporting from MS Word)

Is it possible to change initial view options when exporting in MS Word (2010) to PDF or change it after it is ready.
My specific need is to change Default (which is usually Page) to something like Page and Bookmarks. Ability to change start page would be nice too.
I'm comfortable with changing bits or running some tool from cmd (if it would give stable results).
And yes, I know OpenOffice can do that (when exporting from DOC), but OpenOffice sometimes changes layout of elements...
You can't control these options when creating a PDF from within Word. You should use Adobe Acrobat or something like that. I use PDF Editor (on Ubuntu).

How to create a program on top of Visio?

Is it possible to make a standalone/independent (from visio) program that is built on visio. Say, can i attach some of the design templates and visio drawing page on to my form??
Thanks
Visio supports VBA. With that, you can add all kinds of interactivity to your document.
And, you can embed visio in another program with the activex control.
Both of these methods require visio to be installed on the machine (if that's what you were getting at by the "independent" comment).
The Visio Viewer may or may not install the activex control or support VBA, I don't know.
There's a value stream mapping tool called SigmaFlow VSM that is an application built on Visio like you want to make. Basically the tool loads up Visio and strips out a lot of the Visio toolbars and puts their own UI in. Obviously it requires you have Visio installed.
There's a similar tool called eVSM that leaves the Visio UI in place, but provides a toolbar and templates and stencils for the purpose of building value stream maps.
I prefer the eSVM approach, where you end up giving the user the full ability to do whatever they want within Visio, while making the very specific task of Value Stream Map diagram creation easy.

How to Pretty print VBA code?

How do you copy VBA code into a Word document and retain the VBA editor color scheme?
You can use Notepad++ to accomplish this in three ways. Just so you know, Notepad++ is a more advanced version of Notepad, which supports syntax highlighting of different code files "out of the box" - Visual Basic included!
Download & install it, fire it up, and load up your VBA code. You should automatically see it beautifully coloured (if not, because the file extension is something other than .vb, go to Language -> VB or Language -> V -> VB).
If you need to change any of the colours, you can easily do so - just go to Settings -> Styler Configurator. From that menu, you can change the various highlighting and font options, to suit your needs - although the default usually suffices for most.
Then, go to Plugins -> NppExport. From there, you have three options you can consider:
Directly print from Notepad++
Copy all formats to clipboard
Export to RTF
Export to HTML
The first is self explanatory. The second one - "Copy all formats to clipboard" - will copy the entire file with the highlighted syntax to the clipboard. Once you click it, then open Microsoft Word or your other favourite document editor, and just hit paste! You should see the beautifully syntax-highlighted code. If something goes wrong, then you can try one of the other options (export to RTF/HTML), although I've never had a problem with the clipboard method.
There are two programs on cnet downloads, which are free to try. In case you did not try them, here are the links:
VB-VBA Code Formatter & Printer 2.2
VBAcodePrint 6.13.110
Smart Indenter could be what you're looking for? You'd load the result into Notepad++, set language to VB and save as .rtf/.doc (or print to file, can't remember off the top of my head).
For a more modern approach, Sublime Text users can install ExportHTML from Package Control. This has the added benefit of being able to include the line numbers, and changing the code coloration.
HTML files can be opened directly within Word.
Highlight supports a wide range of Operating Systems and 150+ languages including Visual Basic, although I'm not sure about VBA.
I would recommend this one: planetB
It works well with Internet Explorer (didn't work wit Firefox for me, not sure abt Chrome).
Plus it's online, so no need to install anything (the case of Company/University PC's)
Regards
Wheeliam
The following works with Visual Studio Code:
Start VS Code.
New file.
Copy & Paste the VBA code into the VS Code window.
In the lower right-hand corner, click on "Plain Text" and select "Visual Basic" instead. Note that the code is now syntax-highlighted.
Copy & Paste the formatted code into Word.