I am relatively new to VBA programming and I have come across a debug error for a macro we use at work. the macro was written by another colleague who has no left the company. I will explain what happens originally the macro ran on windows 7 Microsoft 0ffice 2010 with no faults no we have migrated to windows 10 Microsoft Excel office 365 I get "run time error '5'" invalid procedure when I debug it is failing at the below code
AppActivate "Microsoft Excel"
is it because excel is referenced differently in 365 any assistance would be greatly appreciated
thank you Chris
Related
I have developed a macro in VBA Excel 2016, which extracts information from emails in Outlook (sender, subject, date, etc), and exports this information in an Excel sheet.
The code works fine in Excel 2016, however, in Office 2013 versions I get the following error:
Automation error. Object library not registered
I would greatly appreciate if someone could help me solve this error.
This error appears in the following line of the code:
Set olNs = olApp.GetNamespace ("MAPI")
Actually, I already solved the issue. It was so simply as, when defining the correct libraries for 2013 office, saving the file, closing it, and then opening it again and then running the macro.
But anyway, thanks guys!
I need some help regarding the "Cannot run the macro (...). The macro may not be available in this workbook or all macros may be disabled.". I have tried the most common suggestions like enabling macros & compiling the project but it does not help.
Short introduction:
I have created a macro which for years run succesfully (let's call it old version) but recently the company upgraded to Office 2016 Professional Plus and it started giving "Subscript out of range error". I have verified and corrected the macro - the reason was quite trivial: new versions of excel create 1 sheet in new workbook while the older ones created 3. The macro tried to do an action in a non existing sheet.
I have saved the changes and sent the macro for testing (new version).
The macro runs at Workbook.Open by showing a simple form, but new version does not show the form on client's computer. Simply nothing happens. I have added a command button, which starts the macro and sent it for testing, but after pressing the button there is again a "Cannot run the macro" message. I thought thet maybe there is an error in the code but after compiling and double checking everything on my PC I could not find any errors. So I have created a new workbook from the scratch with a single line macro:
Sub test()
MsgBox "macros enabled"
End Sub
To my surprise running this macro on client's computer also returns the same error message. At this point I thought that there are some security settings that prevent running the macros but a) the old version of the macro is working, b) I have asked the client to download some free example macro from the net and it also works.
Just to add: the new version of the macro (and obviously the MsgBox macro) is working fine on my home PC (Office 2013), my work laptop (Office 2019) and my wife's work laptop (Office 365). The problem is only on client's machine.
Any suggestions will be appreciated.
TL:DR Macro is working on Office 2019, 2013 and 365 but returns error on Clients Office 2016.
During a meeting, when I had a chance to test it myself, it turned out that the macro was deleted by their mail server antivirus. So #rene was right to suspect it.
Thank you all for help.
I have a user who just got a new computer (Windows 10 Pro running Office 2013) and he can no longer open a macro enabled workbook.
I finally identified that the Userforms are causing the issue when I created a new workbook and added some VBA to it. Everything worked fine until I went to insert a Userform, that's when it crashed. I did some additional testing and found he can open .xlsm files except when a userform is in the VBA.
I looked into the References in the VBA window and checked the libraries, he seemed to have what he needed and I added anything I thought was missing but nothing helped.
Visual Basic for Applications
Microsoft Excel 15.0 Object Library
OLE Automation
Microsoft Office 15.0 Object Library
Microsoft Forms 2.0 Object Library (keeps unchecking itself but even when checked doesn't help)
Ref Edit Control
What references could I be overlooking here?
The VBA code is not affecting it, I ran the opening code without any forms and it opened and enabled macros just fine.
What is preventing Excel from running a macro enabled workbook with userforms or adding a userform?
I have a very old VB6 application, we have lost the source code. It can call excel 2003, 2007 to
Launch excel
Insert value to the new sheet cells.
I guess it use com to automate the excel, anyway we lost the source code and cannot contact the programmer.
After we upgrade the office to 2010, it cannot insert value anymore, just a blank sheet ....why?
Do anyone have the same experience as me? old win32 program work on excel 2003/2007 , but don't work on 2010.
Attach screenshot for your reference:
when using excel 2007 , it can fill the value to sheet.
when using excel 2010 , it cannot, and the windbg show some exceptions, how can I troubleshoot it?
Even if you could trace/capture, I don't think that would help you much.
Based on the simplicity of the code, you would be better off remaking it from scratch. If it's something proprietary and very useful, you should probably consider having both versions installed at the same time, which has worked for me just fine.
In Excel 2010 it's really easy for me to make a macro that opens a website, selects data from the website, and pastes it into a workbook.
I've searched everywhere to figure out how I can do it on my Mac running Excel 2011, but I'm guessing that since they are just reintroducing VBA into the Mac version of Office that it may not have the capabilities (yet).
Can you help me figure out how to do this if it is possible?