How do I get rid of Word VBA project junk? - vba

When I look at Word VBA on my work computer I have what looks like junk projects. On another PC I have only the normal and currently open documents? Is there a way I can clear this?

These are either hidden documents belonging to addins you have installed, or they're documents that have ended up in your Word startup folder.
Under file..options..addins, check in "Active Application Add-ins" that you don't have anything you didn't want or know about.
Under file..options..advanced..general..file locations, note down the folder for "Startup". Look in that in Explorer and make sure those TMP files aren't in there (you may have to turn on hidden files).
Chris

Related

PhpStorm Search Everywhere is not working, do you know the solution?

I don't know this is off topic or not, I'm using general channels. Is there a solution for Search Anywhere in PhpStorm. I work with Laravel but when I use the feature I can't find the file even though it exists.
Looking at your screenshot: based on the fact that ALL files in the project tree have that sort of "dirty yellow" background color... it looks like ALL of your files are considered excluded / outside of the project for some reason.
Most likely a user error of some kind. E.g. you may have opened it from a different path (i.e. when symlink is involved), may have c=misconfigured it later somehow (marked folder as Excluded by mistake or whatnot) or maybe even some sort of config file corruption (pretty unlikely).
Anyway, please do this:
Close your project
Go to the project root folder and delete your .idea subfolder (that's where your project settings are stored).
If you have that project still visible in the IDE (Recent Projects on the Welcome screen) -- you may remove it there as well (to avoid any possible confusion).
Now create a new project in PhpStorm from scratch using existing files: just use "Open" and point to the folder with your project.
Please check filter option. If you are doing file search then click on Files tab.

How do I create a Word VBA personal VBA code library as I have done in Microsoft Excel..?

How do I create a Word VBA personal code library as I have done in Microsoft Excel..? I had this working, but today it broke and I cannot make it work again. I originally did this because my Normal.dot file blew up and I lost all my macros. I found a blog post that described how to do it, but I cannot find my way back there. I've Google this extensively, but not found a solution.
There are some twists & turns here, as described below...
In Microsoft Excel, one can easily create a "code library project". This is simply a standard XLSB file with VBA modules in it, saved in the ..\Excel\STARTUP folder alongside the PERSONAL.XLSB file.
When the VBA editor is open in any other XLSX/B file, the modules in the code library file are always visible. And thre's not a requirement to create a VBA project reference to see them. The library modules can be natively edited as if they were an integral part of any other file, without requiring the library file to be open in another window to do so, as shown in the picture...
However...in Microsoft Word, it seems to work differently, and...strangely. If the same is done: create a DOCM file with custom code modules, and save it in the ..\Word\Startup\ folder, those modules are not visible in the VBA Project Explorer.
Following along the chain of logic from Excel to Word, and do as others have done...save the DOCM as a DOTM instead, and save it in the ..\Templates folder with the Normal.dotm file. Still, it is not visible in Project Explorer.
It's not until Normal.dotm is opened for editing and the library DOTM is added as a VBA Project Reference that it finally appears in the Project Explorer, but only while Normal is open. Plus...it opens the code library file for editing in another window..! If Normal is saved with that reference, and a new document is created from it, the library code cannot be edited and displays the error "project is unviewable"...
It's not until the library DOTM file is opened for editing in a second window that it's code becomes editable, and it does so in all Word VBA windows on all documents at the same time.
There is one glimmer of hope: if I create a new blank DOC from the library DOTM instead of Normal.DOTM, it works..! Any document created from the library retains a link to the code modules there, including any new or edited ones, and they can be edited natively right there in the Project Explorer. And this includes the code modules in Normal.DOTM too.
It seems the "editability" is one way: documents created from any other template can see & edit both their own code and those in Normal.DOTM, but not the other way around: documents created from Normal.DOTM can only see their own code.
How can this connection be made two-way for all documents, regardless of what template they were created from..??
I've been trying to wrap my head around the possibility it may be a security/malware issue, but I can't come up with one. If macros are already enabled in the Trust settings, malware is already 99% on the way to controlling a machine anyways. The only step left is enabling VBIDE.
A very similar question on Microsoft Answers:
Is there a startup or template file in Words that allows one to store "personal macros", i.e. macros that one wants to have always available while editing documents (I am seeking the equivalent to the PERSONAL.XLSB file in Excel, where I can store macros that then are available in all sheets that I open).
And the solution given:
Word uses the default template Normal.dotm for this purpose. Macros stored in Normal.dotm will be available in all documents. Apart from that, Normal.dotm also serves as the default document template, and it also stores the user's formatted AutoCorrect entries.
Just like Personal.xlsb, Normal.dotm doesn't exist in a clean new installation, but it will be created when needed.
The location for Normal.dotm is
C:\Users\<username>\AppData\Roaming\Microsoft\Templates
AppData is a hidden folder, so you must display hidden files and folders in order to see it in Windows Explorer.
Similar questions (also on answers.microsoft.com) have been offered same type of solution.
Macros that should be globally available can be stored in Normal.dotm or in a template located in the Startup folder for Word. See also:
And:
In Word, personal settings (those that aren't stored in the Registry) are stored in the Normal template, Normal.dotm. When you change and save settings or create macros, they are automatically saved in Normal.dotm unless you choose to save them in another template. Normal.dotm is automatically loaded when you start Word, and new Blank Documents are based on Normal.dotm.

Macro fails in Word 2013

I have a Word macro that has been working fine for ages. I have recently upgraded to Word 2013 and the behavior has changed.
It occurs on the following line:
Doc.SaveAs Path + "Manual\" + TitleString + ".htm", wdFormatFilteredHTML
which builds a valid file path and name and saves the current document as an HTML page.
Under Word 2013, the macro opens a file save dialog box with no filename and with the default file extension (.docx) instead of (.htm), as if the filtered HTML mode was no more available.
I have tried with named arguments, and also with the new SaveAs2 method, but saw no change.
How can I solve this ?
I fond this comment on the DataZX.CN forum:"I Had the same problem. I'm running a windows 8/64bits on an ACER laptop. SOLUTION : remove the Add-in "Icloud Acer ...".
I happen to use Acer desktop, and there was indeed this Icloud add-in pre-installed in Word. After disabling it, the macro works !!!!!!!!!!!!!!!
Thanks StackOverflow for pointing me in the right direction as always...
and thanks Yves for spreading the info...
I removed Acer cloud plugin from Word and excel just to be on safe side.
Blame foolish manufacturers like Acer for another bundled piece of crap software that causes more harm than good.
Quoted from MSDN forum post...
http://social.msdn.microsoft.com/Forums/office/en-US/59c0da80-a7e6-4026-855c-f6b9fbf9c386/word-2013-vba-documentsaveas-dialog-appears-even-applicationclassdisplayalerts-?forum=worddev
...From all you tell me, my feeling is that there may be another third-party application (or a virus) mixing in - that the display of SaveAs is not coming from your application.
This is difficult for you to test, since whatever it is is probably loading with Word...

How to Create VBA Add-In with Shared Codes for All Excels?

I'm writing VBA codes for multiple Excel spreadsheets, which will be shared with others from time to time. At some point I find there are lots of duplications in my works. So I want to find a way to share codes in a sort of Excel add-in, like the .xla file.
But when I tried to save the Excel file containing shared codes as .xla file, I got some problems:
The file cannot be edit anymore after I save it in the default add-in folder
If I move the .xls file to a folder other than the add-in folder, and open it directly - I cannot use its classes - which creates problems for sharing the codes
Any ideas to create add-ins in a flexible and powerful way please?
Thanks a lot for the help
Not completely sure this is what you're looking for, but ...
(1) save the .xla/.xlam code by clicking the save icon in the VBA editor. HOWEVER, the thing that saves is the thing currently selected in the Project Explorer pane, which lists all open VB Projects and which is usually on the left. Even if you are staring at your just-edited VBA code, clicking the save icon will not save your code unless it is also selected in the Project Explorer pane. You won't get feedback that anything was saved - but you can verify by checking the file timestamp in a separate window.
(2) if you have an *.xls file which (via the formula bar) refers to VBA functions from your *.xla / *.xlam file, then if you open the *.xls file without opening the .xla,.xlam file first, Excel may create external links to resolve the formulas (i.e. referring to a file which is not open). If you have moved or renamed the *.xla file you can get stuck with those "mangled formulas" and need to edit out the pathname links that Excel inserted using a global substitute. If you arrange to open the .xla,.xlam prior to any *.xls file that uses it, you shouldn't have a problem (e.g. by using the default folder).

Using Office 2007 extension (i.e. docx) for skin based On-Screen keyboard

I'm creating a On-Screen keyboard for my application, and it supports skins as well.
Here's what I'm doing with the skins, I have a folder which contains some images and a xml file which maps the images to the keyboard, I want to be able to have the folder as a zip file like in Office 2007 (.docx) and iPhone firmwares (.ipsw), I know I can simply zip the folder and change the extension, what I need to know is how to read the files in the code.
You've got two options, either 1) just use a zip library like SharpZipLib or DotNetZip or 2) try to use the System.IO.Packaging namespace. I think option 1 would be the easiest probably.
There's nothing really magical that Office and other programs are doing, they're just reading a zip file and pulling stuff out of it as needed. Instead of pulling an image from a disk you just pull it from a MemoryStream.