ashgull80
07-23-2014, 02:16 PM
hi
i would just like some help on why this vba doesnt work.
im trying to make it open an existing work doc then copy the data into the word doc.
it works find if the "invoice template" is already open but it wont open it if its not.
Thank you
Private Sub cmdEnter_Click()
With GetObject("C:\Users\home\Documents\AT Electrical\Invoices\InvoiceTemplate.docx")
.tables(1).Cell(1, 2).Range.Text = frmwriteinvoice.txtinvoicenumber.Value
.tables(1).Cell(3, 2).Range.Text = frmwriteinvoice.txtinvoicedate.Value
.tables(1).Cell(5, 2).Range.Text = frmwriteinvoice.cboinvoicejobnumber.Value
End With
End Sub
i would just like some help on why this vba doesnt work.
im trying to make it open an existing work doc then copy the data into the word doc.
it works find if the "invoice template" is already open but it wont open it if its not.
Thank you
Private Sub cmdEnter_Click()
With GetObject("C:\Users\home\Documents\AT Electrical\Invoices\InvoiceTemplate.docx")
.tables(1).Cell(1, 2).Range.Text = frmwriteinvoice.txtinvoicenumber.Value
.tables(1).Cell(3, 2).Range.Text = frmwriteinvoice.txtinvoicedate.Value
.tables(1).Cell(5, 2).Range.Text = frmwriteinvoice.cboinvoicejobnumber.Value
End With
End Sub