|
-
Sep 25th, 2005, 01:45 PM
#1
Thread Starter
Hyperactive Member
Microsoft Excel Object Library question
Hello everybody
I`d like to know if the Microsoft Excel 11 Object Library, installed by Microsoft Office 2003, can be used on machines which might have another version of Microsoft Office installed.
-
Sep 25th, 2005, 01:48 PM
#2
Re: Microsoft Excel Object Library question
Moved from Classic VB forum.
If your early binding by adding the reference then you will incur issues with different class interfaces between different 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 
-
Sep 26th, 2005, 01:17 AM
#3
Thread Starter
Hyperactive Member
Re: Microsoft Excel Object Library question
so what can I do? How can I late bind to the Excel Object Library?
-
Sep 26th, 2005, 01:39 AM
#4
Re: Microsoft Excel Object Library question
You can late bind Excel by declaring the variable as an object and using createobject. You must however be aware that some functions may not be available in older versions of Excel..
Code:
Dim objEX As Object
Set objEX = CreateObject("Excel.Application")
You will also not have the intellisense associated with the early binding method.
Danny
Never Think Impossible
If you find my answer helpful then please add to my reputation
-
Sep 28th, 2005, 01:22 AM
#5
Thread Starter
Hyperactive Member
Re: Microsoft Excel Object Library question
ok. It worked. But, I still haven`t understood the difference with the code I used :
VB Code:
Set oApp = New Excel.Application
Set oWB = oApp.Workbooks.Add
oWB.Sheets(1).Cells(1, 1).CopyFromRecordset rsTmpMhxanhma
oApp.Visible = True
Am I not creating space for the oApp object at runtime as well? Does it have to do with the fact that oApp has already been defined as an Excel Application object. Finally do I also need to late bind the Excel.Workbook object as well?
-
Sep 28th, 2005, 06:42 AM
#6
Lively Member
Re: Microsoft Excel Object Library question
This link may help you with your Early/Late knowledge.
http://www.dicks-clicks.com/excel/ol...#Early_Binding
Here is my method, while you are writing the application, set a reference to the appropriate library:
Now delcare your variables:
VB Code:
DIm oApp as Excel.Application
Set oApp = CreateObject("Excel.Application")
Since the reference is set, oApp. will bring up the intellisense use. When you are done wrting the code and testing, and ready to distibute your project:
Uncheck the reference and replace your Application specific variable types with Object:
VB Code:
DIm oApp as Object
Set oApp = CreateObject("Excel.Application")
Make sure you Compile to catch any errors with the code. When doing automation, you may need to use the applications constants in place of some things becasuse Late Binding can't take care of everything. It is more reliable of a method than early if you don't know what version's of office will be using you project and that the version's may switch.
Hope this helps a bit.........
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
|