C
Colin Foster
Hello all,
I've managed to write the code to open up an excel workbook from within
access and then go to a specified named range. However, once that has
happened, I need some specific data to be automatically input into the excel
workbook.
I can make this work in word (having received copious help from this NG) by
using bookmarks, so I've tried a similar route using named ranges in excel &
got so far, then hit the brick wall that probably means I'm almost there!
The code that I'm using is as follows...
Dim oexcel As Object
' start Microsoft Excel.
Set oexcel = CreateObject("Excel.Application")
With oexcel ' Make the application visible.
.Visible = True
' Open the workbook.
.workbooks.Add ("C:\GBTDatabase\Templates\Precast Concrete Production
Sheet.xlt")
' Move to each bookmark and insert text from the form.
ActiveWorkbook.Names("Project").RefersTo
(CStr(Forms!FrmProjects.ProjectName))
End With
Its the last bit of "RefersTo" that I think that I need the help with.
At the moment, if I run this code, the excel workbook opens & the cursor is
sat at the range "Project", however, back in Access, I receive an error of
424. Object required.
Thanks for any help
Regards
Colin Foster
I've managed to write the code to open up an excel workbook from within
access and then go to a specified named range. However, once that has
happened, I need some specific data to be automatically input into the excel
workbook.
I can make this work in word (having received copious help from this NG) by
using bookmarks, so I've tried a similar route using named ranges in excel &
got so far, then hit the brick wall that probably means I'm almost there!
The code that I'm using is as follows...
Dim oexcel As Object
' start Microsoft Excel.
Set oexcel = CreateObject("Excel.Application")
With oexcel ' Make the application visible.
.Visible = True
' Open the workbook.
.workbooks.Add ("C:\GBTDatabase\Templates\Precast Concrete Production
Sheet.xlt")
' Move to each bookmark and insert text from the form.
ActiveWorkbook.Names("Project").RefersTo
(CStr(Forms!FrmProjects.ProjectName))
End With
Its the last bit of "RefersTo" that I think that I need the help with.
At the moment, if I run this code, the excel workbook opens & the cursor is
sat at the range "Project", however, back in Access, I receive an error of
424. Object required.
Thanks for any help
Regards
Colin Foster