Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 12-22-2011, 10:11 PM
macropod's Avatar
macropod macropod is offline Let Office Object Library 14.0 work in Office 2007 Windows 7 64bit Let Office Object Library 14.0 work in Office 2007 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
  #2  
Old 12-22-2011, 11:26 PM
tinfanide tinfanide is offline Let Office Object Library 14.0 work in Office 2007 Windows 7 64bit Let Office Object Library 14.0 work in Office 2007 Office 2010 32bit
Expert
Let Office Object Library 14.0 work in Office 2007
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
Hi tinfanide,

As mentioned in my last post:

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.
Sorry, I still don't understand what numeric values and Word names are.
The refs I'm reading:
http://msdn.microsoft.com/en-us/libr...ice.12%29.aspx
http://msdn.microsoft.com/en-us/libr...ice.12%29.aspx

Code:
Sub setTableBorders()
 
Dim wrdApp As Object
Set wrdApp = CreateObject("Word.Application")
Dim wrdDoc As Object
Set wrdDoc = wrdApp.documents.Add
wrdApp.Visible = True
 
' Dim wrdTbl As Table doesn't work in Excel VBA
Dim wrdTbl As Object
Set wrdTbl = wrdDoc.Tables.Add(Range:=wrdDoc.Range, _
NumRows:=4, _
NumColumns:=1)
  
With wrdTbl
For r = 1 To 4
    .Cell(r, 1).Range.Text = ActiveSheet.Cells(r, 1).Value
Next r

''''''''''''
.wdBorderTop.wdLineStyle = 1
''''''''''''

End With
End Sub
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Let Office Object Library 14.0 work in Office 2007 Excel VBA: How to add a reference to Microsoft Word Object Library? tinfanide Excel Programming 7 12-12-2011 05:21 AM
Problem: object library invalid or contains references to object definitions aligahk06 Office 0 08-19-2010 12:29 PM
Using Office Premium 2007 Trial with Already Installed Office Home and Student 2007 SME Office 1 10-07-2009 06:51 AM
Let Office Object Library 14.0 work in Office 2007 Office 2007 Professional shipped from US, will it work on UK Windows PC's ? OfficeDude Office 3 08-16-2009 02:11 PM
Access Object library 10 Gyto Office 0 10-09-2008 09:04 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:55 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft