PDA

View Full Version : [SOLVED:] Copy range from word table and paste into inkEdit control



Jfp87
08-21-2016, 11:52 AM
Guys,

I'm copying a cell range from a word table and pasting it into an inkEdit control. Everything works fine except that the borders of the cell are also being pasted into the control.



Function fcnReadLibStatement(strNodeKey As String) As Range
Dim oTable As Table
Dim oRow As Row
Dim orng As Range
Dim str As String
Set oTable = oDoc.Tables(1)
For Each oRow In oTable.Rows
Set orng = oRow.Cells(1).Range
orng.End = orng.End - 1
If orng.Text = strNodeKey Then
Set fcnReadLibStatement = oRow.Cells(2).Range
Exit For
End If
Next oRow
End Function


Sub RangeToInkEdit(orng As Range)
orng.Copy
SendMessage inkPreview.hwnd, WM_PASTE, 0&, 0&
End Sub


What am I doing wrong?

Joe

gmaxey
08-21-2016, 12:02 PM
First you code doesn't compile (oDoc is not declared or set)
Second, you post two procedures that take arguments but make us guess what those arguments could be.

The most likely thing you are doing wrong is you are setting your function = to a cell range which incudes its end of cell mark.

Set orng = oRow.Cells(2).Range
orng.End = orng.End - 1
Set fcnReadLibStatement = orng

Jfp87
08-21-2016, 10:22 PM
Greg,

oDoc is declared as a public variable and set somewhere else. I only posted a fragment because I was convinced the solution would be obvious.

Your right, I forgot to strip the end of cell mark. That fixed it.