I'm developing an application written in Visual Basic 6.0 that supports exporting listViews to Microsoft Excel documents. Everything works perfectly fine if a user has an older version of Microsoft Office installed.
Now I want to add support for users who only have Microsoft/Office 365 on their systems. I've googled my way into depression in the past couple of days because I don't know much (or anything really) about dll/ocx files or registries. I'm not even sure if something like this can even be done because VB6 is really old, as noted here.
I've tried using this approach, but it didn't help me.
Right now, I'm getting a 429 runtime error
ActiveX Component can't create object
on line
Set objExcel = CreateObject("Excel.Application")
I only have Microsoft 365 trial version (no older ones) installed on the system and have these two things checked in my references:
I've also tried searching for Excel.Application in the registry, as suggested here, but I can't find the path to the corresponding ActiveX file (which probably means it is not registered if I understand this correctly).
What can I do? Any help would be greatly appreciated.
Never mind, I found the answer myself. The problem was that I had older Office versions installed when I installed new 365 package and for some odd reason the .dll files for 365 version weren't registered. When I deleted those older versions all the working .dll files were gone with them.
I did a repair of the 365 installation and it's working perfectly now.
Related
I'm developing an office-js addin for corporate client which insists on using legacy versions of Excel (1708 or 1808).
But when I install excel from office 365, I get version 1906.
In the old days, with software, there were installers you could find in a directory that had version stamps on them, and you could create a VM, and just install the version you wanted. But the fancier installers appear to download stuff automatically and always (at least default to) the latest versions.
How do I install a legacy version of Excel on a VM for testing?
There's no special process for getting an earlier version when you are testing add-ins. It should be the same process as an end user would use. Please try the steps at this article: Revert to an earlier version of Office. I think you can find the build numbers that you will need either from your customer or from this page: Update history of Office 365.
My client recently migrated from 32-bit Excel 2016 to 64-bit Excel under Office 365 and retained 32-bit MS Project Standard 2010.
I have VBA code native to MS Project Standard 2010 which manipulates the Excel 2016 Application by early binding via the Excel 16.0 Object Library reference. Following migration of Excel to the Office365 64-bit version the library reference to it (in MS Project Standard 2010) is no longer available. It is not MISSING it is just not available in the list. It won't even load by GUID. I don't have admin rights and can't inspect or edit the registry. My IT support explained that the issue is probably because we are mixing 32-bit and 64-bit applications.
I have worked round the issue by converting code from Early-binding to Late-binding. I probably didn't catch everything (I have created a very lot of code in a very lot of application tools) and my concern is that some feature of my code that has not been converted correctly may not be discovered for some time.
My question is, should the Project 2010 application (Project 14.0) be able to make reference to the 64-bit Excel 16 under Office365 Object Library? If so, what should my IT support guy be looking at to fix the problem please?
If the answer really is no I will just have to stick with the late-binding and do some extensive testing.
You cannot cross-reference between 64-bit libraries and 32-bit libraries in the same host. The host can only use libraries of the same bitness. Late-binding won't help you in this situation - it helps you where there are version mismatching but not when bitness don't match.
If you need to continue automation between Project and Excel, then you may need to have a 32-bit Excel installation, or consider installing 64-bit Project. There's the third option of shelling out to VBScript or Powershell and running it out of process but that can be a lot of work.
In my VS2012 project with Internet Explorer 10 installed if I add a reference by going to the COM references and choose MSHTML then it gives me the version that is installed in the GAC which is an old 7.0.3300.0. If I actually look in system32 or sysWOW64 then the .dll tlb version is a much much newer version.
How should I develop against the newer version?
If I understand it correctly mshtml is installed with Internet Explorer so if my deployment machines have IE10 then I should have no problems right?
Can anyone guess why the GAC has the old version in it? I have just check 2 other Win 7 installs and it is the same. GAC is 7.0.3300.0 but elsewhere it matches the IE version.
EDIT: The other Win 7 machines all have VS installed. I just looked on another Win 7 and there is nothing in the GAC. Is VS2012 installing this in the GAC?
Update after Comment
It appears that there are a few questions about this. this reference from the comment also this question which Hans was also involved in. I also found this forum thread as well on the topic.
I still down know what I should be doing, but I can certainly simply follow like a sheep the instructions. I suppose I need to create a PIA that will allow me to call the newer methods (This fixes VS), but understand that if this code is used on a PC that does not have the compatible MSHTML / IE version then it will crash. (Same as the Office PIA and if you call for example an office 2013 method that does not exist on an Office 2010 installation.).
In my question I have linked to what are probably seen as the more correct answers to this issue.
If someone is looking for a quick and dirty solution then use late binding. I will explain specifically in my case what this means.
Dim div as HTMLDivElement
'make div something
div.getElementsByClassName 'this was not working!!!
This would not compile as the reference that Visual Studio is using is an old version.
So instead of follow the above because I only needed this a couple of times I changed the code to this.
Dim div as Object
'make div something
div.getElementsByClassName
Now Visual Studio will not have a problem with it. The problem you do face is that the final end user must have at lease a version of MSHTML (which is installed with Internet Explorer) that has this method or higher.
I hope this helps people who are still trying to work out what PIA's are and how they work in Visual Studio and MS environments.
I have a set of Windows programs that is mostly created with VB6 and VC++ 6. Its installer is created using InstallShield.
A couple users have recently reported a problem trying to install it on Vista. It is complaining that "MDAC 2.6 Sp2 cannot be installed on this machine. MDAC 2.6 Sp2 requires any one of the following configurations", and then lists several OSes, Vista not among them.
A little googling shows that there's a bug in InstallShield's handling of MDAC - it shouldn't be checking for it on Vista, because there is no such thing as MDAC on Vista (there's a new thing - "Windows DAC").
I could make the change to my InstallShield project suggested on that page, but I am concerned about doing so, because I have no way to test it (this problem does not occur on all Vista machines, and I haven't been able to make it happen on any Vista machine I have access to).
However, after looking at Wikipedia's page on MDAC, I can't imagine why we would need it for our programs in the first place. We're not using any databases, at least not explictly (maybe some Microsoft component that we're using is using it, though?).
I was not the original author of the InstallShield project. I am beginning to suspect that MDAC might have been inadvertantly added to it, or perhaps advertantly but just as "uhhh, maybe we need that".
How can I explicitly tell whether my programs need MDAC or not? I can look at the references and such in the VB6 and VC++ projects; is there any way to tell from those whether I can safely remove MDAC from the InstallShield project? For example, perhaps there's a single MDAC reference which, if not present in my VB/VC++ projects, means that my programs definitely do not require MDAC?
Thanks in advance for any help.
I expect you are right, MDAC was probably included with the original InstallShield project configuration, and nobody has bothered to remove it.
On the VB6 side you should be able to tell if MDAC is being used by going into the "References" dialog (I think its in the Projects dropdown menu of the ide) and checking to see if there is anything in there to do with MDAC or MSAccess. I haven't worked with VB6 in a while, but the text should look something like "Microsoft ActiveX Data Objects 2.x Library".
I'm guessing it is less likely that it is being used On the C++ side, but you could try searching for keywords like msdado, mdac and msaccess to see if theres any sign of a #import on one of the mdac dlls.
When deploying to Windows XP and later there is no reason to include MDAC or Jet 4.0, since even XP RTM (gold) shipped with MDAC 2.7 as well as Jet 4.0.
Microsoft Data Access Components (MDAC) release history
How to obtain the latest service pack for the Microsoft Jet 4.0 Database Engine goes into more recent Jet history.
MDAC releases include compatibility typelibs for ADO, so even if your program was compiled against MDAC 2.6 it will actually use the latest ADO on a target machine. The real grief can come if the program early-binds to ADOX.
ADOX never shipped with appropriate compatibility interfaces, so programs should almost always use late binding with ADOX.
DAO is another issue, but (a.) nobody should really be using it anymore without a good excuse and (b.) it died at DAO 3.6 so there should be no compatibility issue as long as your programs were upgraded to 3.6 and Jet5x (Jet 4.0, Access 2000 format).
The story gets more complicated when deploying downlevel from XP of course.
Beginning I think with Windows XP Microsoft began including MDAC. However, in MDAC version 2.6 and later they no longer included the Jet 4.0 components. (Jet 4.0 SP8 can be found here)
If you are using Visual Fox Pro you need to install either the ODBC or OLEDB drivers depending on you code for that.
ODBC
OLEDB
All of these downloads depend on having at least MDAC 2.6 installed.
It seems if you try to reference the Office COM objects (as you would do in other development environments), Visual Studio gets it wrong - and it just won't work.
So you must use the converted type library that Microsoft hand-converted and makes available for download, and download, and download.
Now it seems that in order for my application to run it needs the Office Interop code, which is contained in an assembly.
Now i don't want to force my customers to install the Office 2007 Primary Interop Assemblies, Office 2003 Primary Interop Assemblies or the Office XP Primary Interop Assemblies. i want an xcopy deployment.
If i manage to get a hold of Microsoft's copy of the interop assemblies, can i just copy them to by Bin/Debug and Bin/Release folders?
If i include the Office 2007 interop assemblies, will it work if the customer has Office 95 installed, or do i have to include all versions of the Office Interop dll's Microsoft has ever published?
This is a common question with a rather complicated answer. Mary Lee of MSFT is a great resource for information about this:
http://blogs.msdn.com/vsto/archive/tags/Deployment/default.aspx
Using ClickOnce to deploy is the closest you are going to get to an XCopy install of any application built on VSTO.
Also, check this post:
http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/1666d2b0-a4d0-41e8-ad86-5eab3542de1e/
Finally, Misha has a great blog:
http://blogs.msdn.com/mshneer/archive/2006/01/05/deployment-articles.aspx
The PIAs are specific to the version of Office you are targeting, so the 2003 PIAs are necessary for targeting 2003 and the 2007 PIAs are necessary for 2007. Automating Office 95 via managed code is something I have not done before, but I can imagine you are directly referencing the type libraries so a RCW is generated for you and has nothing to do with PIAs.
HTH
Colby Africa (MSFT)
From my own experience:
If you wanted to target Office 2003 and above, then you'd use the Office 2003 PIAs - and limit yourself to the Office 2003 API. The code would run on Office 2003 or later. You could still call Office 2007 functions using reflection, but that's not pleasant.
I imagine it's much the same story if your baseline version is Office 2000 - though I've not tried it, and I believe the earliest version for which Microsoft themselves provide PIAs is Office 2002 (XP).
You can create your own Interop assemblies for 2000, and I've no reason to believe that you can't do it for '95, though you're the first person I've ever seen ask for '95 support! It goes without saying that if you create your own Interop assemblies you'll need to deploy them with your application.
In any case, you want to use the highest Office version you can get away with as your baseline, so that you can support as many features as you can without resorting to reflection. You should develop your code on a machine which has only that version of Office installed.
In my case, I develop for Office 2003 and know that my users also have 2003. So, I ask them to ensure that they have the ".NET Programmability Support" feature enabled (which you can do via Office 2003 Setup via Add/Remove Programs if you choose the Change option). That option basically installs the PIAs to the GAC. For those users that can't do this, my setup program detects the lack of the PIAs and installs them prior to installing my application (as it does for the .NET framework).
XCOPY deployment? Yes, I'd like that too - but forget it. For one thing, if your add-in is going to work in 'high' security mode, then you're going to need a code-signed COM 'shim' to sit between your code and Office, and that needs to be registered. I believe VSTO provides its own shim, if you choose to go down that path (I didn't, since I needed to be able to 'drive' Office from scratch rather than relying on the user to start the application).
Deployment - and dealing with the installation & security issues - is one of the hardest parts of Office Add-in development with .NET, and it's a real kicker that it comes right at the end when you thought you were done.
My strong advice is to save yourself days and weeks of hassle, and look at Add-in Express. I've only recently come across this myself, and have been kicking myself ever since because it could have saved me so much time. It has several benefits that I think would be useful to you:
It allows you to create a single add-in targetting Office 2000 to Office 2007 (sorry, not '95), regardless of what version you happen to have on your development PC.
It creates an installer for you (which even works on Vista!), which in itself is worth the price.
It comes with its own COM shim, and is integrated to the extent that you don't need to worry about it.
It will allow you to have a single add-in that has a menu/toolbar interface in Office versions up to 2003, but a ribbon interface in 2007.
Note that I have no affiliation with Add-in Express (other than as a recent customer), but equally I've not yet converted my projects over to using it. The initial tests that I have done lead me to believe it's pretty good - and definitely the way to go for small to medium projects.
If i manage to get a hold of Microsoft's copy of the interop assemblies, can i just copy them to by Bin/Debug and Bin/Release folders?
It worked for me. When I compiled the program I had it reference the interop (PIA) dlls in the bin and then deployed it that way to the customer.
If i include the Office 2007 interop assemblies, will it work if the customer has Office 95 installed?
No, you mst have the interop dlls for the version of Word you are targeting. I suppose it might be possible to write your code so that it chcks the version of word running on that machine and at runtime chooses the correct interop, but you need to include them all.