I'm getting this error message: "Run-time error 5981. Could not open macro Storage" This happens when I'm creating a new Word document using a template. The code is posted below. When we run this macro. It create a new document but it shows the error. Please help where i am doing wrong.
Sub AddTemplate1()
Documents.Add Template:="C:\Program Files\Microsoft Office\Templates\Letter_Portrait_Template_CONFIDENTIAL.dotx"
End Sub
I also experienced this error.
After weeks of searching the internet, tried everything what was suggested: Setting authorization, renewed my Normal.dotm etc etc.
I finally solved the problem by changing the compatibility - mode from 'windows xp' to its normal mode (windows 10 in my case) for the (yes outdated) VB6.exe
Related
After launching my project in VS2019, I suddenly got a Character is not valid error, and I was not able to run my project anymore.
I didn't change anything. I even did some undo's just to be save, but no luck.
The error remained, and it didn't point me anywhere.
I restarted VS and then it even got worse.
I couldn't see my code anymore. I just see question marks, and 6995 errors, all (unexpected token and character is not valid).
I tried several things, including deleting the .suo file, the settings file.
Restarting the pc and so on.
Sadly enough the "Previous Version" history of Win10 is switched off, so I can't go to a recent backup.
If I click on the designer he gives me the folling error message:
If I continue, I see my designer file in the end.
When I double click on a button, to try and see the code, he gives me new code in the designer file. Which is really strange.
Any idea on how to solve this?
Basically, this issues arises from this topic: SolverOptions: How to find the parameter position (AssumeNonNeg)?
When I open a file and import the .bas file and run it, everything works fine. However, when I try to apply the same procedure for all similar files using shell via VB script, I am getting the following error:
Run-time error 1004: cannot run the macro 'SolverReset'. The macro may
not be available in this workbook
I initially tried without SolverReset and in that case I got an error saying
Run-time error 1004: cannot run the macro 'Solver' The macro may not be available in this workbook.
It looks like as if Excel is not activating Solver add-in? What might be the problem here?
Thank you!
After many trials the following worked for me:
in front of each Solver function (eg. SolverReset, SolverOptions, etc.) I put Solver.xlam! and ran the code. It didn't work but gave a warning that there was no Solver.XLAM in the directory. So I simply went to the folder C:\Program Files\Microsoft Office\Office15\Library\SOLVER and copied both Solver.XLAM and Solver32.DLL to the directory. That was it!
Hope someone finds this useful!
I was working on a Form and then Access crashed. When I tried to open it, I was prompted with an error which I didn't recognize how to fix right away. Something like
Form1 doesn't exist , if the invalid form name is in a macro ...
At the time, I couldn't figure it out, so I hit "Compact and Repair", closed and re-opened access a few times. Then there was another message, don't exactly remember but soemhting like "To continue, all VBA code must be deleted." I said Ok, because I have a few back up copies. But that didn't fix anything.
Then I figured out how to fix the original error. "Form1" was my default form to open on startup, so I changed it. So everything works, I copy the code back in, but obviously the code doesn't work. The error message is:
Compile Error user defined type
on the DAO.QueryDef
Then I follow MS Help and check the references, and when I click on Tools -> References, I get
Error acessing the System Registry.
So, any thoughts that include not messsing with the Registry?
Ok, so the real problem was the
Compile Error: User-Defined Type Not Defined
iDevelop was right, the file was corrupted. I had to make a new access file (they were .accdb not .mbd , but some concept), and import all objects without the code.
To make sure wasn't corrupted, I copy pasted it into Notepad first, and then into the new file. (Just as an extra precaution). And then it worked.
I am still getting the error:
Error accessing the System Registry.
when I go into Tools-> references,
but, I think it is probably related to my permissions, so maybe it is intended.
I am trying to switch a Excel VBA macro from Windows XP to Windows 7. Both of the Windows versions are 32-bit operating systems. My Windows 7 version is Enterprise edition.
The VBA code works fine on Windows XP. When I have tried to run the code on Windows 7, it crashes and reports no error description.
I have registered msinet.ocx, which appears to be required for Microsoft Internet Transfer Control 6.0. I have also tried to fix security issues by adding the additional com components tabctl32, comctl332/232/32 and comdlg32, all of which are ocx files. However, nothing changes - my code still fails on Windows 7.
Once msinet was unregistered, Excel VBA opens my Workbook, reports the missing reference msinet and does not work at all. How do I resolve this issue?
Awkward. Open the sheet in an Excel session with Macro Security set to high or medium, and reply 'No' to the dialogue about enabling VBA macros in the sheet.
If it opens, you should still be able to view the project, and this might show an obvious missing reference or an error if you attempt to compile it.
Next: save the workbook as html and close Excel. Clear the temp folder, restart excel, open the html file and save it back into Excel format. If you're lucky, all the legacy objects and references will be cleared out and replaced by versions compatible with your new OS.
This works about half the time.
The system not crashing when msinet.ocx is not registered doesnt necessary means that it is the problem.
If you have a call to that library (msinet.ocx) in any procedure inside of or called from the ThisWorkbook module and you have that library unregistered, then when the file opens and tries to run the On open macro the module will not compile and therefore wont run the line of code that makes it crash. (I am only guessing that this might be your case.)
Try to find out which exact call makes your system crash.
Let msinet.ocx registered.
Open the file without activating the macros.
Then manually run Step by Step (F8) through the opening code of your file ( Private Sub Workbook_Open() )
Eventually you will reach the exact line of code that makes your system crash. Whit that information you will be able to get more help.
NOTE:
To open the file without activating the macros you can use one of the following methods:
Press and keep pressed the Shift key after you doubleclicked on the file to open it(from the windows explorer). For this method to work, the Excel application must be clossed.
If the Excel application is open, then go to the VB editor and type application.EnableEvents=False in the immediate window (and press enter to run it). Just be aware that this will disable the events on every file in that instance of Excel. You will have to set it back to true or close the application (not just the file).
Check if you don't have references to missing libraries, if so simply uncheck it. I had a similar problem and it helped in my case.
I have a Windows Forms application in a single project written in VB.NET 2003 (legacy code). There is a MainForm and a SecondaryForm that is run by the MainForm. When I run the application through the MainForm, I can debug without any problems.
However, if I just run the SecondaryForm, I get the debug error:
There is no source code available for the current location
when stepping over:
_routeId = CInt(myVar)
At this point I am no longer able to debug through my code window, but I have to use the disassembled code.
Why does this happen and how can I fix it?
My problem was of the Step-Into kind. I could step into a procedure inside a usercontrol just fine, but when its End Sub was encountered and I was leaving that Sub, I would get the "There is no source code available for the current location." error page.
The solution that personally worked for me was: In the Project Properties page, under "Debug", uncheck "Enable unmanaged code debugging".
I have seen this issue many times... and more often than not it is a reference(s) issue. Is it your code that has "no source" or is it Microsoft code? Do you have multiple versions of the .NET Framework installed?
Double check your references.