Why does the VBA Editor open on its own sometimes? - vba

I created a script in Outlook 2003 VBA that watches for new appointments, and sets them to tentative and no reminder as I create them. I find that seemingly at random, the VBA editor will open itself. It doesn't happen when I use the new script, but it did happen this morning when I un-hibernated my laptop, for example.
The editor doesn't pop up any runtime errors or highlight any lines in the script, it's just there as if I had pressed Alt-F11 to launch it. Sometimes I close other apps and see that it's been sitting back there for a while.
This behavior has only been occurring since I created this new script. Any ideas why this would occur?

As stated in, Microsoft Support Center:
"This problem occurs only if the Microsoft Visual Basic Editor window
is maximized."
Solution:
Un-Maximize Visual Basic Editor and close it.
And you are done!

If you have previously set breakpoints, it may be that you still have a phantom breakpoint. Try choosing "remove all breakpoints" and see if that clears the problem.
Check also that you have not chosen "Break on all errors" under options, and that your error handler is functioning properly.

Believe it or not, this is a known issue. Check out this MS Support link:
http://support.microsoft.com/kb/829059
I have the same problem and found it while I was looking for a solution. Since it gives no advice, I kept searching and came across your post. I will come back with an update if I find a solution.

The MS page linked by Jaquez hints at the answer; just make sure you don't run the editor maximized, and the problem should go away. If you restore it to a non-maximized state, then resize it to take up the whole screen, it should remember its position.
It's a pain if you only have a small screen, but on a normal large monitor it works fine, and solved the problem for me.

I have the same problem, except that it only occurs when I've gone in and unlocked the VBA project for editing and haven't restarted Outlook. It seems to open up when I get a new email (that's when my VBA runs) so basically I just have to restart Outlook and lock the project back up.
Sorry I don't know what's really causing it, but locking the VBA project should fix the problem...

My solution was to search for the .otm file of my VBA project. It was stored under data\microsoft\outlook. I closed Outlook and deleted the .otm file. Restarted Outlook and it was solved.

Just wanted to add that I was running into a phantom breakpoint issue with VBA in excel. Clearing all breakpoints did not work for me, but I resolved it as follows: Copy all content from offending module into a text file. Delete module. Re-create module. Copy back in all text. Save. Phantom breakpoint gone.

Related

How to keep IntelliSense Complete Word option off?

IntelliSense has a mode where if you hit the spacebar, it will automatically type out the suggested auto-complete word. In order to prevent this from happening, you can hit the Escape key before pressing Space. This will close the autocomplete popup, so that the suggested word is not automatically typed.
I prefer the alternative setting, where I actually have to hit the Enter key to accept the suggested autocompletion. If I just type Space, I want a space to follow the characters that I actually typed.
I know that I can toggle between the undesired mode and the second mode I describe, which I do want. To do this, I click Edit -> IntelliSence -> Toggle Completion Mode.
My problem is that this setting never sticks. It constantly reverts to the wrong mode. I'm not sure exactly when it's changing, but it seems to revert back several times a day. If I change this for one Solution, it won't apply to my other Solutions. Even if I apply it to a solution, close VS, reopen, and start working again, it will have reverted.
Does this happen to everyone else, or is this unique to me? Is there some global setting that forces this feature to stay off always? Do I have a corrupted file somewhere that's causing this?
No, this is normal behavior and this setting behaves like what you described in the previous VS versions.
However, thanks to those members who is reporting this issue and Microsoft has fixed this behavior in the latest VS2019 version.
Since VS2015 is not supported by Microsoft so far, so this behavior cannot be fixed on VS2015 and I suggest you could install the latest VS2019 Community and get what you want.
Once you click the Toggle Completion Mode under Edit-->Intellisense, no matter you close VS, create a new project or a solution, use other c# file editor, it will never revert back.

Word Save Template command returning error

I recently discovered the blissful convenience of being able to use the File, Save command from within the VBA Editor window to save the currently attached template without having to actually be in the template or close out of Word.
I thought it would be nice to have this command available on a Ribbon Tab or the QAT or even a keyboard shortcut, so I first added the Save Template command to a Ribbon Tab. But when I clicked on the tab, nothing happened.
I thought perhaps I needed to tweak things a bit with a macro, so I recorded a macro and clicked on the command, to see what the VBA statement would look like.
It looks simple and straightforward enough, very similar to a bazillion other "ActiveDocument" macros I have stored that run without any issues:
ActiveDocument.AttachedTemplate.Document.Save
But when I run the macro, I get the standard "Runtime error" message, with no hint as to what is wrong.
I cannot find any documentation regarding this command in any of my source material or anywhere on Google, nor can I find any discussions about it.
Any ideas what's missing here? Thanks in advance!
As I discovered, and Cindy Meister confirmed, the following works:
ActiveDocument.AttachedTemplate.Save
It will work even if the template is closed. The version that you got from the Macro Recorder, ActiveDocument.AttachedTemplate.Document.Save works only if the template is open. The version above works whether it's open or not. I don't program much in Word, but it looks like a template's Document object/property is instantiated when the template is opened and otherwise is nothing.

The source file is different from when the module was built?

Mediocre VB.Net student here, but not a total noob. I've been getting this error: "The source file is different from when the module was built. Would you like the debugger to use it anyway?"
I chose Form1.vb on the "Find Source: Form1.vb" open file dialog box that followed. After that, my program has been acting very weirdly. For example, I have codes inside the sub that handles Button1 click, and then I moved those codes somewhere. Now when debugging, when I click that button, it executes the codes that I just removed a minute ago!
I'm scared because I don't to waste the 2 months of hard work that I've already spent on this project. Too friggin stupid to remember to backup the whole thing. Stackoverflow, please don't fail me now.
As you have explained i think the scenario is your modified code is not build correctly.. once rebuild the entire solution.
Please be sure work in debug mode, and then try Clean solution and then "Rebuild All".
refer following links may also help you..
the source file is different from when the module was built
Warning given when debugging source code in visual studio 2010

Xcode code folding issue

After updating Xcode(5.0.1),one of my project files is automatically unfolding the code every time i leave the file or close Xcode.And this weird behavior is bothering me a lot,i already tried to delete and recreate it but didn't worked.
Anyone knows what might be causing this single file to have its code unfolded?
With Xcode-9, this issue is resolved. Code folding is being remembered and saved by Xcode 9 Editor.
Code you have/had folded exact before last source build/save, is automatically stored upon document/file closure. And same will be visible as it was (folded) when you will open document/file next time.
You don't need to do anything (there is no any option in Xcode tool bar to enable or disable) to save your code fold.
There's no way around it. xCode will unfold your code automatically. Period. There is no option to "preserve" code folding. (sad, but true...)

Can I get the VBA syntax check error without the automatic syntax check?

When I write VBA code, I tend to cut and paste variable names or other bits of code. This results in frequent syntax check errors that result in the message box popping up. That's annoying, and I'm aware that I can turn it off via Tools > Options > Editor > uncheck Auto Syntax Check.
This doesn't seem to prevent the VBA editor from actually checking my line - it still turns red. I don't mind that behavior, because it doesn't interrupt anything. And it does let me know if I do, in fact, have some sort of problem after I'm done with the line, which is nice. Unfortunately, I'm not always smart enough to diagnose the error on my own, and the text in the message box is actually helpful. But I've turned off the message box!
Is there a way for me to display that error, short of temporarily turning the message box on?
You can compile, with Debug>Compile, which will bring up the same message. IF there's more than one compile error you might have to deal with that one first.
This comment is for users of Visual Basic for Excel on a Mac.
I am using Visual Basic in Excel verion 16.14.1, (the latest version as of July 2018), as part of Office 365 on an iMac Pro, running High Sierra.
Under the Tools tab of the Visual Basic editor, there are only three choices:
References...
Macros....
VBA Project Properties......
None of these sub-menus lead to "Options", nor to anything which allows you to turn on and off "Auto Syntax Check"
Instead that option can be found in Excel ==> Preferences tab. However. checking or unchecking the box does not change the behaviour. In both cases, the text turns red on a syntax error, but in neither case does the annoying pop-up window appear.