|
-
Jul 30th, 2017, 10:40 PM
#1
Thread Starter
Member
MS Access Missing References
I'm a C#.Net developer and haven't done VBA in a long time, so forgive my ignorance.
I have an Access 365 app from a client and I'm trying to work on it off site. I have Office 2013. When I open the app I get the error "Can't find project or library" on this line:
Code:
Dim appOutlook As Outlook.Application
If I uncheck the missing references won't this break the code once it's back at the client site? Again , they're referencing Office 365.
In the references list I'm missing:
- Microsoft Office Outlook 16.0 Object Library
Microsoft ActiveX Data Objects 2.0
Microsoft Office Excel 15.0 Object Library
Microsoft Office 15.0 Object Library
1) If I remove these references, won't that break things back on the the client's site?
2) How do you normally handle a situation like this?
Thank you
-
Jul 31st, 2017, 01:53 AM
#2
Re: MS Access Missing References
Welcome to the Forums.
This is what happens when you use Early Binding and lock your application in to a particular version of another application. If you remove the references yes it will break.
Usually if you have to support multiple versions of, Outlook for example, you would use Late Binding and use only the features that are common to all the needed supported versions.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 31st, 2017, 09:32 AM
#3
Thread Starter
Member
Re: MS Access Missing References
 Originally Posted by RobDog888
Welcome to the Forums.
This is what happens when you use Early Binding and lock your application in to a particular version of another application. If you remove the references yes it will break.
Usually if you have to support multiple versions of, Outlook for example, you would use Late Binding and use only the features that are common to all the needed supported versions.
I understand and completely agree.
I'm just getting started, so I don't yet know what functionality is required from each reference. If they're referencing Outlook just to send an email, that can be accomplished with most Outlook references. Same for reading/writing from Excel.
Sounds like there needs to be code that check for a specific version of each DLL.
-
Jul 31st, 2017, 04:15 PM
#4
Re: MS Access Missing References
that can be accomplished with most Outlook references
yes but if you change the reference version to run on your machine, it will not run on theirs when you take it back, you can not change the reference back except on a machine with the required version installed
to use late binding
remove all references to office applications
Dim appOutlook As Outlook.Application
change all msoffice type variables to type object
replace all instances like set appOutlook = new outlook with set appoutlook = createobject("outlook.application") appropriate to the application required
make sure all office constants are declared or use their literal values, else they may default to 0
see the thread at the top of this forum for the tutorial on automating office applications
the project should then run on your machine and still run when you take it back
there maybe some lines the may fail, on your machine, as they use properties or methods, only valid in later versions, not much you can do about those in your earlier versions
the only other option, that i would hate to recommend, is to upgrade your office to a later version
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|