What is the actual encoding used in Access' VBA editor? I have been searching for a concrete answer for quite a while but with no luck.
I thought it was UTF-8 but I'm not very certain.
My main issue is that when writing a query in VBA I sometimes need to test it in Access' query editor. When copy-pasting however, I lose my native characters (greek in my case) as they turn to gibberish.
I have tried pasting in a text editor and saving it as different encodings but I can never recover the original characters.
Thanks in advance.
Edit
Let me explain this a bit further:
As you can see I can write my greek characters in the VBA editor normally:
However, copying the first line in Access' query editor, I get the following:
Same goes for a simple text editor:
So I am inclined to think that the problem lies inside the clipboard, due to the encoding used for the greek characters. I guess they are not Unicode, as I indeed have to make the change in the System Locale for non-unicode characters. So how are these characters saved/copied? In what encoding?
Answer
Actually this problem was solved by switching the keyboard input language to greek (EL), when copying the actual test string.
I am still not sure however, as to why that happens. If anyone can provide some insight into this, I would love to hear it.
Thanks again
The VBA editor does not support Unicode characters, either for input or display. Instead, it uses the older Windows technology called "code pages" to provide support for non-ASCII characters.
So, the character encoding in the VBA editor corresponds to the code page that is used by the Windows system locale as specified in the "Regional and Language Options" control panel. For example, with my system locale set to "Greek (Greece)"
I can enter Greek characters into my VBA code
However, if I switch my Windows system locale back to "English (United States)"
and re-open my VBA project, the Greek characters have changed to the corresponding characters in the new code page
If "Control Panel" -> "Regional and Language Options" -> "System Locale" is set correctly but you still suffer from this problem some times then note that while you're copying your keyboard layout must be switched to the non-English language.
This is applicable to all non-unicode-aware applications not only VBA.
Credit goes to #parakmiakos
details in this: http://www.pcreview.co.uk/forums/use-greek-characters-visual-basic-editor-t2097705.html
Looks like making sure your OS is set properly, and font choice inside the VBA editor.
I had a similar problem with Cyrillic characters. Part of the problem is solved when set the System locale correctly.
However, The VBA editor still does not recognize cyrillic characters when it has to interpret them from inside itself.
For example it can not display characters from the command:
Msgbox "Здравей"
but if the sheet name is in cyrillic characters it does it well:
Msgbox Activesheet.Name
Finally, it turned out that these kind of problems were solved when I changed to 32 bits version of MS Office.
Related
Short version:
So I have a Word doc with very specific formatting guidelines, into which Japanese users have to input text. Despite being specifically told not to, instead of using "tab" to create indents, they will very often use full-width Japanese spaces (U+3000). I want to somehow prevent the entry of this character to avoid having to reformat.
Long version:
We send out Japanese/English-language script templates for Japanese users to input their own dialogue into. They will often ignore the formatting of the script, using hard returns and full-width spaces to hack-format the doc (very common practice among Japanese Word users). This leads to unnecessary time spent on re-formatting. As I see it I have three options:
Prevent the entry of undesired characters, by blocking the character
or setting up a dialogue box every time it is used.
Automate a dialogue box to pop up when the document is saved, displaying a message to users to make sure no undesired characters were used.
Create a macro to auto-replace undesired characters on my end.
Any suggestions? Help is very much appreciated.
How can I copy queries from Oracle SQL Developer with format. Unlike Toad the query format is lost as I paste it in any document.
I am referring to font formatting.
Not (yet) supported in 4.x.
Your best shot is to vote/rate it up: "Copy to clipboard" should include HTML and/or RTF clipboard formats
As a workaround, if you really, really want it bad - you might try out long and tedious path of using "Print" option in color to some PDF printer, then copying it from there (some programs like Preview on Mac OS X preserve formatting while copying from PDF)
There is an extension called "Copy As HTML/RTF". But version 4.x doesn't support extensions. Only 3.x and earlier versions support them.
if you are talking about Highlight Format, I can suggest you to use one plugin in Notepad++, which preserves the Font color as in Notepad++ when you copy to Microsoft Word.
You can visit this site: Copy Notepad++ text with formatting?
SSMS has the same issue. With SSMS, it appears that there is a 10,045 byte limit. At 10,046 char/bytes, the sql format changes to text. There are two ways to resolve this issue that I know of so far.
Select all the sql text in the query window, open the word doc, and drag the text over to word instead of copy/pasting it.
Break your copy/paste text into sections less than 10,045 bytes and paste to word code section by code section. In other words, select sections of the sql text that are smaller than 10,045 bytes and copy/paste multiple times into word instead of the whole query at once.
I have installed 2.02 Stable 64 bit version of TeXnicCenter and have following problem with spelling check. In one of my existing LaTeX document the grammar of the text in English is checked correctly and all typos are being underlined. In this file German language is not being recognise although I change setting for the language in the options for spelling. However, in other of my existing LaTex document the spelling tool is not recognising English text but it recognises text in German.
Here some hint: It could be that the other LaTex file has been created within German Windows environment. Now I have the Win 7 environment in English. Is it possible that it is connected with the text formatting? Is it possible to change it? Or is there a different cause?
Some other hint: When I generate a new LaTex file the spelling works fine for both English and German. So it is just the problem with the existing document.
Good hint from your side towards text encoding Phil. Solution is a bit different though. Apparently TexnicCenter is saving .tex files with ANSI encoding as default. As soon as .tex files are saved with UTF-8 encoding, spelling check works fine. There are not options to be set in the program. One has to go through Files->Save As and set the encoding while saving.
I know this is an old topic but here is what solved my issue: manually change the project language. Go to project > properties and then change the language there.
I am writing documentation about an app and want to explain the code.
I want to copy parts of the Objective C code from Xcode to Microsoft Word.
I don't know how to put the code with syntax highlighting (and maybe line numbers, too ?!) into Word.
Does anybody know a usable solution for this little problem?
Copy and paste works !
Nevertheless, make sure the option "Copy colors and fonts" in Preferences>Fonts & Colors is checked !
If you need this in Pages you can paste into textedit then copy/paste from textedit into pages. I have yet to find a way to paste directly into pages and preserve the text color etc
If you copy from Xcode and paste into Word you get syntax highlighting etc as expected. You just need to reduce the font size to make it more readable and avoid wrapping etc. It would probably be a good idea to define a suitable Style in Word, e.g. "Code" which would have the required font size etc for pasted code.
It supports these by default in Xcode 4. And what you need to do is to choose "Use Orignal Format" in Word or Power Point.
If you need this in Pages, then a workaround is to copy in Xcode, paste in Word, copy again and then paste in Pages (That is if you have MS Word available).
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.