View Single Post
 
Old 12-22-2011, 10:11 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi tinfanide,

As I said
Quote:
you'd change all the Word-specific definitions to 'Object':
Dim wrdApp As Object, wrdDoc As Object, wrdTbl As Object, wrdTpl As Object
That includes wrdTbl! You don't need to do that with 'Dim wdRng As Range', as the range object is common to both Word and Excel. You do need to be careful when coding to ensure the Word range is acted on when working with a Word range. That's easily enough done when you use the Set statement to say what the wdRng variable refers to.

As for "I don't want to start everything in Word Object Library 12.0", I think maybe you've misunderstood what that implies. If the 12 library isn't available with early binding, a later available library will be used - it just doesn't go the other way. With late binding, whatever library is available will be used (eg 9, if that's all that's available).

As mentioned in my last post:
Quote:
You might also need to change some Word-specific parameters to the values. The code will throw an error on any affected lines. Simply replace those parameters' names with their numeric values.
Thus, for the line:
.Borders(wdBorderTop).LineStyle = wdLineStyleSingle
you need to look at both the 'WdBorderType Enumeration' and the 'WdLineStyle Enumeration' in the Word vba Help file, and subsitute the numeric values for the Word names.

You'd probably find the conversion to late binding less painful if you were to create a new Word document with just the Word portion of your code in it as a test sub, then step through the code, identifying the numeric values that go with each of the Word-specific parameters in your code.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote