Excel365 VBA Compile Error on Mac for Generating Outlook Events - 'A Project or Library Cannot be Found' - excel

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.

Related

Excel VBA 7.1 comdlg

This is for VBA 7.1 excel's macro. I am trying to export a file to a location and it crashes at this part.
The error I am running into is "Can't find project or library". The reference not found is the "comDlg". I know this is a referencing error. However, I am unsure how to resolve it.
Private Sub cmdBrowse_Click()
comDlg.Filter = "XML Files"
comDlg.DialogTitle = "Save Export File As..."
comDlg.ShowSave
txtExportFile.Text = comDlg.Filename
I had the same issue with a UCase() function call, a simple VBA.UCase() solved it. If you need any more information please let me know. I believe this macro/excel sheet was made on an older version and carried over to a 64bit Windows 10.
You're trying to use VB6 controls that are unsupported in a 64-bit VBA host. Try a 32-bit Excel install, but consider using Application.GetSaveAsFileName/GetOpenFileName for this kind of thing:
Private Sub cmdBrowse_Click()
Dim promptResult As Variant
promptResult = Application.GetSaveAsFilename("file.xml", "XML Files (*.xml),*.xml", 1, "Save Export File As...")
If VarType(promptResult) = vbBoolean Then Exit Sub 'prompt was cancelled
txtExportFile.Text = CStr(promptResult)
End Sub
As for VBA failing to resolve the UCase function, ...wild things happen with broken project references: I'd expect these to just go away once the legacy 32-bit stuff is removed from the project.

xlwings' RunPython fails on MAC

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.

"User-defined type not defined" error in Excel VBA after upgrade to Windows 10

A co-worker developed a part of Excel VBA-code for me. This code I have integrated in my code.
Both parts of code separate runs fine at Windows 7.
Both parts of code separate runs fine at Windows 10.
Both parts of code integrated runs fine at Windows 7.
Although both parts of code integrated give an error at Windows 10.
The error is a Compile error "User-defined type not defined" directly after opening the file. It is caused by the line "Public objhttp As New XMLHTTP".
Option Explicit
Public objhttp As New XMLHTTP
Public url1 As String
Public src As String
'*******regualr Expression Variables*******
Public regx As New RegExp, matches As Object, match As Object
I have checked all the references under Tools in the Library from VBA.
The installed references are the same in all 4 situations. In all situations I use Excel 2016.
Do you know what can be the cause for this?
Thank you!
I had a very similar problem when Windows 10 rolled out where I work. Something to do with their initial OoTB build of Windows 10 not including a particular msxml dll.
I fixed a few workbooks that this broke by replacing all of these:
MSXML.XMLHTTP
MSXML.ServerXMLHTTP
MSXML.DOMDocument
with these:
MSXML2.XMLHTTP60
MSXML2.ServerXMLHTTP60
MSXML2.DOMDocument60

Excel VBA with SAP GUI 7.40 - SAP.Functions not working

I have a Excel VBA which connects to SAP, pulls some data and does some processing on it. It was working fine with SAP GUI 7.20 But it stopped working when I installed SAP GUI 7.40.
My code is as below :
Dim obBAPICall As Object
' * Create object
Set obBAPICall = CreateObject("SAP.Functions")
.
.
I get following error :
I've already gone through some weblinks and I believe I've all the required references. (In fact, I've added many more in order to troubleshoot the problem).
My SAP GUI version is :
Any help is highly appreciated.
Thank you.
Edit : Following code does not have any problem :
Set SAPguiApp = CreateObject("Sapgui.ScriptingCtrl.1")
Got it ! The problem was with the latest MS office product (and not with SAP GUI 7.40). The IT guys had rolled out some updates in MS Office and it was creating a problem. I restored MS Office and it is working fine now.

Compatibility Between MS-Access 2003 and MS-Excel 2013

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

Resources