0
votes

How can I save a Word document as the value in a table? I've tried this and get a "Type mismatch" error:

Sub saveas_cell()
    ActiveDocument.SaveAs FileName:= _
    "c:\mydocuments" ActiveDocument.Tables(1).Cell(1, 2) & ".doc"
End Sub

I've also tried an object reference (activedocument.table1.("text3"))

Thanks for the help!

1

1 Answers

0
votes

You get an error message because Table.Cell does not return a string, but a cell object. Instead, use this:

"c:\mydocuments" ActiveDocument.Tables(1).Cell(1, 2).Shape.TextFrame.TextRange.Text & ".doc"

You can find more information here.