[AccessD] Exporting table to a word doc

Rocky Smolin rockysmolin2 at gmail.com
Tue Aug 15 14:04:21 CDT 2023


OK - I switched to VBA code - late binding. Got the word doc created and
added the text.  Just need the syntax to save it.

    Dim wordApp As Object
    Dim myDoc As Object
    Set wordApp = CreateObject("Word.Application")
    Set myDoc = wordApp.Documents.Add()

*** Create the text in the doc and then...

   wordApp.SaveAs fileName:="C:\Clients\AGR\Temp\Lease.docx"

throws the error: object doesn't support this property or method.

Does anyone know the correct syntax to save this doc?

MTIA

Rocky




On Tue, Aug 15, 2023 at 10:09 AM Rocky Smolin <rockysmolin2 at gmail.com>
wrote:

> Dear List(s):
>
> I have a very simple requirement to export a table with records of one
> field - field is text format. I use:
>
>     DoCmd.TransferText acExportDelim, , "tblLeaseToWord",
> "C:\Clients\AGR\Temp\Lease.docx"
>
> I get the error message "Cannot Update. Database or object is read-only."
>
> I tried it with the doc file \Lease.docx already created, empty and
> without the doc file present. ICn  assume if I can get this to work the doc
> file will be created by the export? Doesn't need to pre-exist the
> TransferText?
>
> What's the fix for this? Or  is there a better way to export the records
> in this table?
>
> MTIA,
>
> Rocky
>
>
>


More information about the AccessD mailing list