Trying, for the first time, to include images in a WORD Document that I am creating using vb.net.
Using answers on a previous StackOverflow screen (14 and 15 May 2020, by CindyMeister and macropod) I have tried the following code
Dim rng As Word.Range
rng = para.range
Dim img As Image = Image.FromFile(lPath)
Dim objtable As Word.Table
Dim tempTablePara As Word.Paragraph = oDoc.Content.Paragraphs.Add()
objtable = oDoc.Tables.Add(rng, 1, 1)
objtable.Cell(1, 1).Width = img.Width * 0.75
objtable.Cell(1, 1).Height = img.Height * 0.75
objtable.Cell(1, 1).HeightRule = Word.WdRowHeightRule.wdRowHeightExactly
Dim objShapes = objtable.Range.InlineShapes
rng = tempTablePara.Range
tempTablePara.Range.Delete()
objShapes.AddPicture(lPath)
But where does the ‘para’ come from in the second line of code. How should I define para?
I have copied and pasted the StackOverflow answer on 14 and 15 May 2020, from CindyMeister and macropod.
The compiler says ‘para’ is not declared.
Tom Croucher is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.