I've been tasked with updating a .xlsm file with VBA that is accessed via the Citrix Workspace application. The previous author has left the company and did not leave behind any further documentation on it.
The VBA is password protected. I've broken and readjusted VBA passwords with a hex editor before, and would gladly try that. Only thing is that the author of this current project also threw in some VBA which prevents the file from being saved as which is then password protected.
Any idea of how I can get through the save prevention VBA? Or perhaps get the file saved as a .zip to my computer?
SOLVED! Despite me flipping "disable macros" and ActiveX components I was still being prevented from saving the file. What I did, however, was navigate to the file's location, did a right click copy, and then just pasted it to the desktop. From there I was able to adjust the file extension to a .zip, and then cracked the password protection via the Hex editor method.
Related
This one has me scratching my head.
We have a "Previewer" which hosts a WebBrowser control.
When this "Previewer" is used to "preview" a Word document or Excel Spreadsheet I use some code to convert the document to a .mhtml file. I then tell the WebBrowser to navigate to that.
This works fine on many machines but not all. On some machines, instead of "navigating" to the mhtml and displaying it in the WebBrowser control, the WebBrowser control takes it upon itself to present a "Save As" dialog, asking the user to save the .mhtml file to their PC.
What is going on here, and how do I stop it?
Thanks
An example of the sort of file I try to navigate to:
"file://127.0.0.1/C$/Users/blahblahblahhere/AppData/Local/furthersubfoldershere/637183327673490444_Document1_486951.mhtml"
All I'm doing is
oWB.Navigate(....)
Ok.... this may also be relevant. This happens when a user is using an add-in we wrote in Outlook 365.... So the WebBrowser control is hosted in our Add-in in one of the forms it pops up as the user is doing their thing in Outlook.
Well, I still don't know why it does this for an .mhtml file, but I found that converting it to .html instead actually works. I was reluctant to do that as a Word Document or an Excel Spreadsheet converted to HTML might produce an .HTML file with lots of associated files, e.g. for images. But while it does indeed do that, as it turns out it still works quite happily in the WebBrowser control. And without popping up that "save" dialog.
If you must use MHTML I have no solution for you, but if HTML is "good enough" for you, well, that's how I fixed it for myself.
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.
I have an Excel 2016 file (.xlsm). After few weeks working on this file, now I'm facing with one small but weird problem - cannot open ThisWorkbook module. As you can seen in the picture, trying to open this module, window just simply freezes on the screen, any mouse's single or double-clicks on it have no effect.
Maybe somebody also had the same issue? What might cause it and how to resolve it?
this might have only worked for me but is worth a try
clear the office cache (C:\Users\username\AppData\Local\Microsoft\Office\16.0\OfficeFileCache\0)
open the file on a different computer and name it something random.
open the file on the first computer and resave file.
As pointed out in Han's comment, it's possible that the module is corrupted. You may be able to salvage it by right clicking the module and using 'Export File...' to save it as a class file.
If this succeeds you can attempt to recover your code by:
Importing the saved file, this will add 'ThisWorkbook' as a class file that can be opened like other modules.
If this doesn't work, try opening the saved file in Notepad. This should reveal your code in plain text.
I literally have this probablem every day or so. There is no answer, I have to save multiple files everytime I make any changes to the workbook. Its incredibly frustrating when all the macros disapear from the list and you can't open a single module
I password protected an Outlook VBAProject and then subsequently forgot the password. Luckily, I exported the VBA code, but I'd like to unprotect the VBAProject.otm file.
I saw online how to do this for Excel projects, but not for Outlook VBA. Any ideas? Tks!
Try using VBA Password Recovery Master.
Also see Download VBA Password Recovery Free Software- Get VBA Password Again!.
Try using the Hex Editor option. Open the OTM file in Hex Editor and try changing the DPB to DPx and save the file and then try opening the vba in outlook.
Note: use the above by creating a copy of OTM file ot it might get corrupted.
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).