Windows defender removing vba code from Word Document - vba

We have a large word application with around 100 forms, 50 modules and 20 classes. Over 100 people get into this application and some of them are seasonal which means that they will use different computers. We are running into an issue where windows defender seems to be removing the the vba from the word document. It seems to only happened every once in a while and we believe it is with someone new to the application. Each time it occurs, the file is broken and we have to use our copy to save over the original version. The size of the file will go from 6,897KB to like 60KB. Below are screen shots that I was able to get from one user that caused this issue. Any assistance on how to prevent this from happening would be greatly appreciated.
This is the first error the user receives when they try to open the word document:
This is the error that the user receives after they click on the "First Error":

Related

Excel 2013 - User can't execute specific macro - File name listed before macro in Macros window

We have a single user unable to execute a specific macro in an XLSM file using Excel 2013. The issue seems to be tied to the user's entitlements because he gets the same error even on a freshly imaged machine. I would love to know if anyone has seen this issue before so we can pinpoint what's causing it internally. This can't be replicated by any other user, but is persistent to the user's account on any PC.
When he tries to execute a macro, nothing happens. No error message. Just nothing. On further review, the macro name looks weird in the macros window. It looks like (File Name).xlsm'!(Sheet Name).(Macro Name) instead of just listing the macro name. Screenshot here:
The macro is a public sub sitting on the sheet. If I move the code to a module, the name displays correctly and the macro runs, but that's not the way the code was designed to function. I'm not looking for help with the code. (This isn't mine to change and it works fine for dozens of users.) But I would be extremely grateful if someone familiar with this could give me an idea of what's happening here and perhaps why it could be tied to a user's corporate entitlements.
Thank you!

VBA Password Prompt shows on Exit from Excel

I have been experiencing an issue where the VBA Password Prompt appears when exiting Excel for workbooks that have a locked VBA project.
For me it is happening on a Win10 / Excel2013 and Win10 / Excel2016 environment. I have searched for and tried a number of possible solutions. See the attached workbook and a step recorder that shows this happening for one of the tests. One interesting difference for the tests that are included to the workbook is in the case where a "pop-up" form is displayed, when closing the VBA password prompt is shown 5 times instead of 3 times on a standard exit from the workbook for the other tests.
Sample Workbook - https://sites.google.com/a/xlautomation.com.au/website/free-downloads/TestVBAPassword%20v2%20Share.xlsm?attredirects=0&d=1
Password to see the code in this workbook...."password"
Step Recorder showing the issue - https://sites.google.com/a/xlautomation.com.au/website/free-downloads/VBA%20Password%20Prompt%20Example.zip?attredirects=0&d=1
I can see from other posts that this problem has appeared over the years and some have resolved it with removing Add-In references, Closing Excel in a certain way none of these are working in my case. It is not a viable option to unprotect the VBA project as the workbooks are shared with others and allowing access to the code would present support issues.
If anyone has further suggestions to resolve this issue please share those back.
I have also include a demo of the issue in action below...
Could it be you have Dropbox installed on your system. A weird pointer to it solved my solution (short of making the Excel sheet into an xlam add-in) in no longer asking for the password:
right click on Dropbox symbol in system tray
Select the gear symbol (settings) at the right top
Select "Preferences"
In its "General"tab set "Show Dropbox Badge" to "Never show".
Click OK
That's it. How that affects Excel I don't know.

Excel giving "System Error &H80004005 (-2147467259). Unspecified error" message

Everytime I load up my Excel document, it repeatedly shows up with the message from the title. The two options are OK and Help. help opens Office Help which is useless for anything. Clicking OK displays another message saying "Compile error: Out of memory." with OK and Help buttons. Clicking OK brings up VBEditor with no debug line selected and no macro popped up either for that matter. Eventually, after it repeats that and complains 20 (exaggeration) more times (I think that's due to having a lot of duplicate code for ActiveX controls on each sheet). It highlights the first line (the Sub declaration) of the code below.
Private Sub ComboBox4_Change()
Range("B3") = ActiveSheet.ComboBox4.text
End Sub
Now this is dealing with an ActiveX ComboBox. Opening a file from an earlier date will give no errors. It's like after a certain date, it just refuses to work with it. And get this, it's only happening on one computer. The files are saved on a network drive, which shouldn't be causing an error.
I'm almost 100% certain I found a solution to this issue. It may have caused issues for someone else 4 years ago, but it caused issues for me today and I wanted to contribute my answer for anyone else running into the same problem.
I had enabled an "Additional Control" in the Controls Toolbox for Windows Media Player. I think when it loaded in a video file, it overran the memory. This is when I started panicking (company computer and all) and Googling and came across this and a few other articles without a real, fast fix.
The hunch: Once that video file was attempted to be loaded in RAM memory (because that's how Userforms work) it locked up all the memory Excel would allow before throwing all the errors.
What I tried from other posts in various places: I rebooted a few times (before Googling, even). I tried the Quick Repair of Office from Add/Remove programs, that didn't work. (I'm using Office 2016.)
So, what worked? I had the idea that maybe I could disable all ActiveX from loading in my file, and Googled that. I got: https://support.office.com/en-us/article/enable-or-disable-activex-settings-in-office-files-f1303e08-a3f8-41c5-a17e-b0b8898743ed and proceeded to disable all ActiveX controls in Excel. I closed the file out. Can't recall if I closed Excel but I probably did.
Then I loaded up my file. (ActiveX is totally disabled at this time.) No errors! I went to VBA (ALT + F11), opened my UserForm, and the video I had inserted and could not remove was just... gone. I saved the file. I closed the file.
I opened Excel. I re-enabled ActiveX in the Trust Center. I opened my file. Still, no more video on my UserForm (I didn't need it anyway) and no "Unspecified" (memory) errors! And, I can save again!
I hope this solution persists... if not I've got some "splainin' " to do. So far, I'm designing and using the Userform, and saving the file, with no issues whatsoever. I think it worked!
I believe the problem was that I had a user form with an acrobat reader display control (like an iframe, but for PDFs). I didn't have this reference or control on that specific computer and it freaked out. Not 100% sure, but the problem no longer exists.
I have been having a very similar problem with WindowsMediaPlayer (WMP) ActiveX control that I have in a Form. Some computers with office 2016 are giving this error code (usless the help button), this is the first post I have found about something similar with WMP, and I found it after searching for this error on ActiveX controls...
So my solution was to go to VBA (alt+F11), right clic on form that has the activex control and then remove it witohout exporting.
The big problem is, that for me, this form is the most important part of the application.
I have no mor information, if I find something I'll come back to post feedback.
I encountered this issue when trying to pull data from an access database. The query I was trying to pull from in the database was an all value query (*). Once I added the individual fields, the error went away.
I've got this error, when I create a user form which has no body section(just header). (Using this method for the messages where I don't expect a user response. Like a progress bar.
Probably, any abnormality(*)or inconsistency with the user form causes this problem.
Solution: Changed the height of the user form just a few pixel.
Just a simple trick worked for me
Go to Excel Options
Manage Excel Add-ins
Uncheck all and click ok

Word opens for real when trying to fill-in the blanks dynamically?

I'm currently using Word documents as templates where blanks have to be filled dynamically/programmatically in PwoerBuilder.
This has always worked fine until the company moves on Windows 7.
In short, the Word application is opened and made invisible.
Word.Application.Visible = false
Except that sometimes, and I don't know why, once the template is accessed, Word opens itself just as if I had double-clicked the template byself through the Explorer - but I didn't.
So, it asks whether I want to open it in read-only mode, since the application already has a handle on the file. And even if I click [Cancel] not to open the file, Word opens with no document, then the application crashes.
It reports PowerBuilder System Error 35.
Error Number 35.
Error text = Error calling external object function open at line 24 in function of_fusion of object n_cst_9999.
The external object that the application is trying to call a function against is Word.
oleobject lole_word
lole_word = create oleobject
lole_word = ConnectToNewObject("Word.Application")
lole_word.Documents.Open("templatefile.docx")
It may work for a few documents, and after a few, the problem comes up. This is the first time ever I meet with this issue.
I'll be glad to answer anyone's question who's trying to help.
Will, you may try setting DisplayAlerts and FeatureInstall properties on Word Application object.
That hid most of word alerts for us. (The code is from C# project and may not be exactly what you need)
Word.Application.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone;
Word.Application.FeatureInstall = 0;
You may also try making a copy of the file before opening it to avoid accessing same .docx from different threads - if that may be the case.

Word VBA Can't Exit Design Mode Error (Word 2003)

I have a Word form that has a bunch of command buttons, form fields, and combo boxes. There is a lot of code associated with the form both in the "ThisDocument" object and another module I added.
If I open the form by double-clicking the document from Windows, it opens and works fine when I enable macros.
However, if I open Word first, and then go to File > Open to open the form, I get an error message "Can't Exit Design Mode because Control cmdInstructions can not be created.
I've seen this error on a few other users' computers also, and it sometimes refers to different controls, not just the cmdInstructions button.
This problem began when we upgraded to Word 2003. Again, if you double-click on the document in Windows to open it, there is no problem. The message only crops up when you have Word already open (with a blank new document).
Has anyone seen this problem before? What do I need to do to my code to avoid this problem?
It may be late, but the answer is to upgrade to Office 2003 Service Pack 3