I am working on macro for my proffesion in the army - I make graphs of air force saftey.
I want to make my job easy so I want that the macro will change somethings - which it does right now and it will save the file and exit.
When I save the file it prompt about the quality loss and I want to bypass it.
Will
Application.DisplayAlerts = false
work?
I cant test it on my computer because it doesnt happen to me here, and I just came back from the army - I will be back there in 3 days, just want to be sure that I have the right answer...
If it wont solve my problem what will?
Thanks!
Although turning off the alerts may hide the dialog from you, I am in complete agreement with Jon. It will mask any and all other errors that you most likely want to see.
Instead of masking the issue you should resolve the root cause of the issue. That is, save the Excel Workbook in a format that can handle the newer features or remove the newer features that are causing the issue.
In the Workbook.SaveAs method you pass a parameter named FileFormat. This is a value from the XLFileFormat enumeration. There are numerous file formats to choose from here but I suspect that you will want the XLFileFormat.xlOpenXMLWorkbookMacroEnabled one. This is the latest format for Excel 2007 (Not sure about 2010).
Good luck,
Doug
Related
I am not very familiar with VBA and I have to perform a task that involves opening a number of Excel files. These are full of broken links and I don't have the time to change things. As I open each file, 5(!) message windows pop up, one after another, and to get rid of them I have to hit "OK".
One of the "OK" windows is this:
Wanting to avoid this, I have
Opened an empty Excel spreadsheet;
Hit Alt+F11 to launch the VBA editor;
Pasted the following code
Sub Appl_Display_Alert_Ex2()
Application.DisplayAlerts = False
ActiveWorkbook.Close
End Sub
And then hit F5 to run it.
However, while I thought that this applied to Excel as a whole, I assume it only applies to the single file, because I then went to open one of my broken files and the 5 windows popped up anyway.
Question: is there a way for me to avoid the "OK" message windows for all Excel files, whatever they are?
I would strongly advise against doing this, as it's not a good practice - generally it's better to simply fix the formulas/tables to avoid this error - but if you absolutely insist on doing this.
You can go to File -> Options -> Formulas -> Error Checking / Error Checking Rules and disable whatever checks necessary to avoid this prompt.
What I'd however recommend you to do instead, is to closely follow this article here and fix it the proper way instead!
This always catches me out, but it appears to be another PhpStorm only quirk. Normally when you "Save as" a document, it will open the new file. This happens in all Adobe products, all Office products, and every other app I can think of... except PhpStorm.
So many times I've forgotten about this quirk and started working over the old file, thinking it was the new one. It's most frustrating.
Is there a way to change this behaviour?
Is there a way to change this behaviour?
Unfortunately no.
Save as is basically a shortcut for Save and then Refactor | Copy.
https://youtrack.jetbrains.com/issue/IDEABKL-332 I guess (based on "duplicate" tickets)
General suggestions (Captain Obvious):
Invoke Refactor | Copy on desired file before making changes in it (so it will sit deep in your mind that the currently edited file will keep changes)
Use Local History to rollback unwanted changes in old/original file.
I have a file which has ActiveX Elements in it that are linked to VBA Code. This file worked fine up until about 1.5 months ago. Now I suspected that it stopped working because of problems with an MS Update that was described here and here.
So far so good.
The computer it is running on has Office 2010 installed. I dutifully checked if the update was installed. It was not.
In fact, the articles described that the ActiveX controlls stop working if the update is installed. Upon further testing, I realized that some of the conrols continued to work! So I thought that couldn't be it anymore...
...and yet... it does seem to be the problem.
I created and tested two files: One with ActiveX Controls and one with Form Controls. Same controls, same code. Really simple code. Here it is:
Sub Schaltfläche2_Klicken()
With ActiveSheet
.Range("a10000").End(xlUp).Offset(1, 0).Select
Selection = 1000
End With
End Sub
Both versions ran just fine on my own computer which has Excel 2013 installed, with the MS update, AND the fix cited in the articles applied! Yet on the 2010 Version that it needs to run on only the Form Controls one ran as it should!
The ActiveX Version created a VBA Error 32809! It errored out on the .Range line.
I tested further... tried to reference a cell using .cells(1,1) which yielded the same error again! Dito for a straight forward selection of .Range("A1").
Finally, I tried recording a macro. That worked, and the code it produced refrenced cells like this, which is normal:
ActiveCell.FormulaR1C1 = "10000"
I checked the macro security settings. Everything is activated. There is no special setting like "Lotus Compatibility" selected. "Z1S1" reference style isn't active either. Neither of these should influence VBA code in my opinion, but it was the only thing I could think of looking at.
Lastly, I could no longer select the ActiveX Elements with the mouse. While they continued to work, I could not select them or right klick them so that the menu comes up to edit them!
So there you are... Does anyone know why this would happen? Has anyone else had this? Any thing else I could look at? I've been searching the intertubes and come up short.
Thanks in advance!
Wild guess: maybe there's something wrong with the FM20.DLL library.
You might check with
Sub M_snb()
c00 = Replace(Mid(Environ(6), 9), "\cmd.exe", "\FM20.DLL")
MsgBox CreateObject("wscript.shell").exec("cmd /c Dir """ & c00 & """").stdout.readall
End Sub
Ok. Here is my non solution solution to my own problem.
Microsoft tells you that the solution to the problem is to install the faulty update they published on all other computers as well and then go fix each one manually. Naturally, I don't have the admin rights to do that, nor the time to implement it.
Saddly this left me with only one solution to the problem. Take out all ActiveX Controlls and replace them with Form Controlls.
After doing this, my spreadsheet, all my code, and the form controlls work perfectly in ANY excel version.
I REALLY HOPE that Microsoft comes up with a better solution, because the current one will not be workable for the vast majority of people.
I've made a program for my assingment, and code it entirely from home. Obviously I need to submit it and work on it from college, i've got about 13 hours until it's due and I cannot for the life of me figure out what these errors mean, I'm guessing its something to do with the paths of the files. To make it clear, the program does not open and it is not the original copy. I do have other copies and I have tried the same approach with the exact same luck. Thank you in advance.
Okay, an update. As I said, I copied it from home, and pasted it in the folder location that it is calling below, however, it's calling an older version of the game which has no relevence to the game(number guessing game), from a location two files up from the actual vb files. Is there a way i can change what the project opens?
In your second picture just drag 'Form1.vb' to the solution Explorer. That way it can recognize your form. I have encountered this problem before and I just did what I said above.
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.