My VBA macros works stable in Excel 2010 enveronment. But if I runing it in Excel 2016, then I catch an error in HypMenuVRefresh command "Smart View handled an unknown exception thrown by Microsoft Office". I test it on different SV versions. In both cases I use MS Office 32bit.
Related
I'm trying to automatically generate outlook events using Excel VBA (on Excel v16.68 or VBA 7.1). The same code works perfectly on Windows OS but encountering 'A Project or Library Cannot be Found' error on 'OutApp As Outlook.Application' when tried on Mac OS for following line:
Dim OutApp As Outlook.Application, OutEvent As Outlook.AppointmentItem
Any suggestions on resolving the error or an alternative?
Thanks!
Any suggestions on resolving the error or an alternative?
Thanks!
VBA is only supported for Excel, Power Point, and Word under Office for Mac. Outlook is not exposed.
Good morning, afternoon, evening or whenever you are reading this.
That's the problem, I have a macro and two PC's
PC One (1): Which Run the macro perfectly.
PC Two (2) Which drops the error in the title.
The macro Connects SAPLogon, and PC Two breaks in this line:
Set Locx = CreateObject("SAP.LogonControl.1")
And here is the function:
Function SAPLogon() As Boolean
Set Lockx = CreateObject("SAP.LogonControl.1")
Set Conn = Lockx.NewConnection
Conn.Language = "S"
SAPLogon = Conn.logon(0, False)
Boths PC have the next exact vba references:
Visual Basic For Applications
Microsoft Excel 16.0 Object Library
OLE Automation
Microsoft Office 16.0 Object Library
Microsoft Forms 2.0 Object Library
SAP GUI Scripting API
But here is my big suspicion about why the macro doesn't run on PC Two:
PC One (1) Has Microsoft Office Personal Plus 2016 32-bit and PC Two Has Microsoft Office Personal Plus 2016 64-bit
The macro has been coded by another employee in 2002 (So I Think it's a 32-bit macro)
The question is:
Can 64 Bit Excel run 32 Bits Macros? How?
Thanks and Cheers
The issue here is that the SAP GUI is a 32bit application, and provides 32bit ActiveX controls for scripting in VBA. These will not work from 64bit Excel, however there is a solution. The comment above refers to another answer that explains more, but there are two solutions I'll summarise:
If you are able to install a new GUI then the latest version, 770 released February 2021 includes an optional install of 64bit NWRFC. This will install additional 64bit OCX controls that will work from 64bit Excel and VBA. (see https://stackoverflow.com/a/68906306/5087459).
If you need to use an older GUI then you will need to make a registry change using a surrogate as described in https://stackoverflow.com/a/65017544/5087459.
MAC 10.12.5
Excel 2011 for MAC
xlwings.__version__ '0.11.2'
xlwings.__path__
['/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/xlwings']
Trying to do a RunPython from excel, always fails with:
Compile Error
Connot find file or library
Trying to narrow down, running the VBA code found in
Function GetConfigFilePath() As String), specifically:
> mymodule = Left(ThisWorkbook.Name, (InStrRev(ThisWorkbook.Name, ".", -1, vbTextCompare) - 1))
invariably gives me a:
Compile Error
Connot find file or library
I see that the
~/Library/Containers/com.microsoft.Excel/Data/xlwings.conf
could not be found but i have no idea how to get it there, any lead please ?
UPDATE: v0.11.4 supports Mac Excel 2011 again, see: http://docs.xlwings.org/en/stable/whatsnew.html#v0-11-4-jul-23-2017
Make sure to check that it references the correct xlwings addin: In the VBA editor, go to Tools > References and select xlwings. Unselect those that start with MISSSING.... Make sure the correct project is selected while you do this.
original answer:
Mac Excel 2011 support hasn't quite caught up with the new add-in. The issues is that Excel 2011 doesn't show the ribbon and so the config file will not be created automatically. We will work on improving the user experience, but for now you should be able to work around it like this:
Create an empty xlwings.conf in the following path (you'll need to create it if you don't have Excel 2016 installed) ~/Library/Containers/com.microsoft.Excel/Data
Edit it following the instructions, if you want to set global settings that deviate from the defaults: http://docs.xlwings.org/en/stable/addin.html#config-file
Alternatively, skip the 2 steps above and include a xlwings.conf sheet as created automatically by xlwings quickstart <projectname>, see: http://docs.xlwings.org/en/stable/addin.html#workbook-settings (you need to use the addin from >= 0.11.3 though as there was a bug in the earlier versions.
This is similar to a question that I've asked yesterday, but I've managed to find a fair bit more information: enough to warrant a new question, I feel.
My office has recently moved to Windows 7 along with Office 2013 - with the except of Access which has stayed as 2003.
Access works absolutely fine except when I try to automate Excel. This is a feature of nearly all my applications.
When I load an old project, the reference is automatically updated to "Microsoft Excel 15.0 Object Library" - it is held as an EXE file in Program Files (x86). Note: it does not say the reference is missing.
When I try to run any code which uses early binding, it fails with the following error message: "Error in loading DLL"
I've since tried late binding by doing the following:
Dim app As Object
Dim wb As Object
Set app = CreateObject("Excel.Application")
app.Visible = True
Set wb = app.Workbooks.Add
This creates the Application, it becomes visible, a Workbook is added, but then I get the following error: "Run-time error '1004':
Application-definted or object-defined error"
If I try to access VBA in the new Workbook I get the following error: "An error occurred initializing the VBA libraries (1004)" The Workbook is loaded in "Compatibility Mode"
The above leads me to believe that the 2 applications may not be compatable, but the following is worth considering:
If I try to use early binding I don't get the Intellisense drop-downs but words like Workbook and Worksheet do auto-capitalise themselves as you would normally expect them to. The code won't compile at all if I don't have the reference set, but it does compile - and throw and error - when it is. I've since tried Word 2013 - who's Object Reference is an OLB file rather than EXE - and I get the full Intellisense features I would except, but it still throws the same error when trying to run.
In a nut shell, does anyone know if I stand any chance of having the 2 work together?
Thanks
I am seeing an Error 438 in an application which has until this point been run successfully without error for more than 2 years. Debug shows that it fails on a fairly inoccuous line:
With gVarWorkSheet.ListView1
The workbook has not changed since previous successful runs. Is there anything in the installation of Excel or on the Windows XP PC in general that could have changed that would cause this?