-
May 17th, 2009, 06:31 AM
#1
[RESOLVED] Different Word Versions for one VB program
Hi friends !
I have a VB solution which has some methods to call Word and creating a complex document there. The original code was done using the word dll of office 2003
Now my customer also has some workplaces where he still uses word 2000 My code would worki in both.
Is it possible in VB6.0 to bind to the needed version of the Office word dll depending on what is existing in the given enviroment ? So if there is word 2000 then it will reference and use word 2000, if its office 2003 then it should reference to word 2003 without needing recompilation at the customer directly.?
how do you handle such situations ?
Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
-
May 17th, 2009, 10:58 AM
#2
Re: Different Word Versions for one VB program
Early binding works only if you know the versions deployed. Late binding will work with any version that's installed, but you can only use the lowest common features, and they'd fail in the 2000 version, for instance.
Code:
Option Explicit
' These are both examples of Late Binding
Public Sub RunAccessMacro(strDB As String, strMacro As String)
'================================================================
'for late binding declare it As Object and use CreateObject() function
Dim AccessDB As Object
Set AccessDB = CreateObject("Access.Application")
With AccessDB
.OpenCurrentDatabase strDB
.DoCmd.RunMacro strMacro, 1
'.Visible = True 'you decide
.CloseCurrentDatabase
End With
Set AccessDB = Nothing
End Sub
Public Sub ExcelMacro()
Dim excl As Object
Dim wrbk As Object
Set excl = CreateObject("Excel.Application")
excl.DisplayAlerts = False
Set wrbk = excl.Workbooks.Open("myfile", , True, , "mypassword")
excl.Run "MacroName", "arg1", "arg2"
End Sub
-
May 17th, 2009, 02:02 PM
#3
Re: Different Word Versions for one VB program
Originally Posted by dglienna
Early binding works only if you know the versions deployed. Late binding will work with any version that's installed, but you can only use the lowest common features, and they'd fail in the 2000 version, for instance.
....
But is it not compatible that way that I could use a Word 2000 dll and access all the common methods like ActiveDocument, Select and all that. What happens when a program compiled with a word 2000 dll is run in an 2003 enviroment ?
Are the word versions not compatible to older versions and older dlls?
( Maybe a stupid question as I never tried that but I had hoped that simple using the older version will also work when word is upgraded. )
Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
-
May 17th, 2009, 02:41 PM
#4
Re: Different Word Versions for one VB program
You want to use the version of Word that is already installed on the machine. You can't distribute the Word .dll for any system
-
May 17th, 2009, 03:12 PM
#5
Re: Different Word Versions for one VB program
Originally Posted by dglienna
You want to use the version of Word that is already installed on the machine. You can't distribute the Word .dll for any system
I see, but what happens when the user changes from word 2000 to word 2003 or 2007 and the program was delivered when he had word 2000 ? I think as long as the office 2000 dll is still used by any program it hopefully will not be deleted during installing the new office version. So my question is wil this stop working and needing an update or will this still work after changing to 2003 ?
Jonny Poet
To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
If anyone felt he has got help, show it in rating the post.
Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
My latest articles :
Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7
-
May 17th, 2009, 04:29 PM
#6
Re: Different Word Versions for one VB program
If it works for w2k users now, it will probably work if they upgrade, if you are using LATE Binding. If your setup program send the w2k dll, (which it can't) then it would break.
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
|