![]() |
|
#4
|
||||
|
||||
|
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] |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Excel table: refer to a particular row?
|
tinfanide | Excel | 10 | 08-05-2015 01:17 PM |
If (C1 = refer to a cell in a range) then (show the description in C2) & (corresponding price in C3)
|
lily | Excel | 9 | 10-23-2014 06:21 AM |
Edit embedded Visio object in Word
|
TimTDP | Visio | 12 | 01-26-2014 12:43 AM |
| An embedded object's formatting gets jumbled | New Daddy | PowerPoint | 0 | 11-17-2013 08:13 PM |
Editing an embedded OLE object
|
DugganSC | Word VBA | 1 | 08-29-2011 01:40 PM |