Good morning,
I would like to replace the address in Word using the one, placed in the Excel cell.
My situation looks like in the image below:
I have got an address in Excel and I want to paste in in the Word bracket, based inside the table cell.
There are some solutions:
Write to Word Document from Excel VBA
Pasting a String from excel to Word using word-VBA
VBA macros: Excel to Word text replacement
which differs from my situation.
My code so far looks like this:
Sub RamsOpen()
Dim appWD As Word.Application
Set appWD = New Word.Application
Dim docWD As Word.Document
Set docWD = appWD.Documents.Open(ActiveWorkbook.path & "\RAMS.docx.docm")
appWD.Visible = True
Sheets("Frontsheet").Range("D18").Copy
docWD.Content.InsertAfter Range("A1")
End Sub
The Word document is opening, but I don't know, where my text has been copied.
The god hint appears to be here:
https://exceloffthegrid.com/controlling-word-from-excel-using-vba/
but applies to the blank Word document I think.
range("A1")
refer to on your word doc? – Samuel EversonTable.Cell
method. I'll leave that there for you but will see if I can dig my project up. – Samuel Everson