Hi, Nick,
Probably just a minor syntax issue, but it's not the :=
character combo. That's standard across VBA for defining
terms for methods such as replace (usually an alternative
to enclosing terms within parens, separated by commas).
Select a line of text in Word with the paragraph mark
included in your selection, and try running this little
macro as is. Hopefully, that will help you find the issue
(I'd need to see exactly how you set up the code in your
macro to be able to tell you -- thought this would get a
faster answer for you than going back and forth again):
______________________________________
Sub testreplace()
Dim MyEx As Object
Set MyEx = CreateObject("Excel.Application")
MyEx.Visible = True
MyEx.Workbooks.Add
MyEx.ActiveWorkbook.ActiveSheet.Range("C7").Select
MyEx.ActiveCell.FormulaR1C1 = Selection.Range.Text
MyEx.Cells.Replace What:=Chr(13), Replacement:="",
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, ReplaceFormat:=False
MyEx.ActiveWorkbook.ActiveSheet.Range("C8").Select
End Sub
____________________
.... be sure you've made the Excel object model available
in Tools, References for whatever module you paste the
sample macro into.
I hope that's helpful.
Best,
Stephanie
-----Original Message-----
Stephanie,
I have setup my excel object as such:
Dim ExcelSheet As Object
Set ExcelSheet = CreateObject("Excel.Sheet")
and here is an example of how I paste into cells
ExcelSheet.Application.Cells(iExcelRow,
iExcelColumn).Value = iHeaderLevel