Save ExcelObject?

Descecrator

Registered User.
Local time
Today, 21:02
Joined
Oct 18, 2005
Messages
11
Dear people,

On my form there's an OLEBound object and it's converted to an excel worksheet. I want to copy from an existing excel-document into that object. That works, but now I'd like te save the object as an excel-file. I've got the following code:

Private Sub Command60_Click()
On Error GoTo Err_Command60_Click
Dim NewObject As Object
Dim DocNaam As String

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

DocNaam = [Forms]![Werkbladentoevoegen]![Tpon]
Forms![Werkbladentoevoegen]![OLEBound64].Object.Excel.Application.Worksheet.EditSelectAll
Forms![Werkbladentoevoegen]![OLEBound64].Object.Excel.Application.Worksheet.EditCopy
Set NewObject = CreateObject("Excel.Application")
NewObject.Workbooks.New
NewObject.Workbooks.EditPaste
NewObject.Workbooks.SaveAs "\\NLFS006\A110154$\Stage Bidteam\Systeem\Werkbladen\" & DocNaam & ".xls"
NewObject.Workbooks.Close
MsgBox ("Het werkblad is succesvol opgeslagen!")
Set NewObject = Nothing
Forms![Werkbladentoevoegen].Requery
Exit_Command60_Click:
Exit Sub

Err_Command60_Click:
MsgBox Err.Description
Resume Exit_Command60_Click

End Sub

The problem is that access says that he doesn't recognize the attribute to the object. Does anyone have a suggestion how to handle this? THANKS!
 

Users who are viewing this thread

Back
Top Bottom