View Single Post
 
Old 08-26-2015, 03:56 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

It's not clear to me how you'll achieve anything better via an embedded Excel object, since you'll have the same issues with variable-length content there. Granted, such an object can be re-scaled, but that doesn't address issues of text-wrapping and font sizes. That said, you could try code like:
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim objOLE As Word.OLEFormat, objXL As Object
Dim R As Long, C As Long, X As Long
R = 1: C = 2
X = 100
With ActiveDocument
  With .InlineShapes(1)
    If Not .OLEFormat Is Nothing Then
      If Split(.OLEFormat.ClassType, ".")(0) = "Excel" Then
        Set objOLE = .OLEFormat
        objOLE.Activate
        Set objXL = objOLE.Object
        objXL.ActiveSheet.Cells(R, C).Value = X
        On Error Resume Next
        objOLE.Application.Quit
      End If
    End If
  End With
End With
Set objXL = Nothing: Set objOLE = Nothing
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote