Jfp87
09-20-2017, 09:20 AM
Guys,
I am using an inkEdit control to preview Building Block content using the following method:
Sub PreviewBBContent(CategoryName As String, BuildingBlockName As String)
Dim oBB As Word.BuildingBlock
Dim oPara As Word.Paragraph
Dim oRng As Word.Range
'Get the Building Block.
Set oBB = p_oBlockType.Categories(CategoryName).BuildingBlocks(BuildingBlockName)
'Create temp paragraph in template.
ThisDocument.Paragraphs.Add
Set oRng = ThisDocument.Paragraphs.Last.Range
'Insert the Building Block content into the scratch range.
oBB.Insert oRng
'Cut the content from the scratch range.
oRng.Cut
'Paste the content into inkPreview.
With Me.inkPreview
.Locked = False
.Text = vbNullString
SendMessage .hwnd, WM_PASTE, 0&, 0&
.Locked = True
End With
ThisDocument.Undo 3
lbl_Exit:
Exit Sub
End Sub
I think it's quite a crude method. Does anyone have a better way of getting the BB content into the inkEdit control without having to insert new paragraphs etc.?
Joe
I am using an inkEdit control to preview Building Block content using the following method:
Sub PreviewBBContent(CategoryName As String, BuildingBlockName As String)
Dim oBB As Word.BuildingBlock
Dim oPara As Word.Paragraph
Dim oRng As Word.Range
'Get the Building Block.
Set oBB = p_oBlockType.Categories(CategoryName).BuildingBlocks(BuildingBlockName)
'Create temp paragraph in template.
ThisDocument.Paragraphs.Add
Set oRng = ThisDocument.Paragraphs.Last.Range
'Insert the Building Block content into the scratch range.
oBB.Insert oRng
'Cut the content from the scratch range.
oRng.Cut
'Paste the content into inkPreview.
With Me.inkPreview
.Locked = False
.Text = vbNullString
SendMessage .hwnd, WM_PASTE, 0&, 0&
.Locked = True
End With
ThisDocument.Undo 3
lbl_Exit:
Exit Sub
End Sub
I think it's quite a crude method. Does anyone have a better way of getting the BB content into the inkEdit control without having to insert new paragraphs etc.?
Joe