Morning,
I have a vb form which populates a row in excel and then the user clicks another button which populates a word document using find and replace (I have put certain text in the document i.e. "date1" which corresponds to one of the cells in the row)
Code
Sub AutomateWord()
' Declare the variable.
' Set the variable (runs new instance of Word.)
Set objWD = CreateObject("Word.Application")
objWD.Visible = True
' Add a new document.
objWD.Documents.Open ("C:\blank.doc")
' Add some text.
Call RepPara("Date1", Format(ActiveCell.Value, "mmmm d, yyyy"))
Call RepPara("First1", ActiveCell.Offset(0, 1).Value)
Call RepPara("Surname2", ActiveCell.Offset(0, 2).Value)
' Clear the variable from memory.
Set objWD = Nothing
End Sub
Display More
This was working until someone asked me if they did not enter the info is it possible that the entry is left blank. i.e the word doc has "date1" text and needs to to be replaced with something (currently) but how can I do so that if the cell is blank it will find and replace "date1" with blank(meaning a blank space)
Thanks in advance