excel ole object

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table with a one saved excel workbook with two sheets as a base
table. (I just copied this workbook into this table's ole field). The one
sheet is with data and the another one is with a chart.

I want to open the chart assigning a new data to the data sheet (from query)
so the chart will be changed and save this chart into another users' table
with user's records. So, each individual user had his/her own chart in that
table.

I don't want to save this workbook/charts in any other places except database.

I need to be able demonstrate this chart to a user (it doesn't matter
whether using an access form or using Excel with openning it from the access
table).

How could I implement all this?

Thanks
 
Here is the code I'm trying to implement:

On Error Resume Next
Set xlapp = GetObject(, "Excel.Application")
If Err Then
Set xlapp = CreateObject("Excel.Application")
End If
On Error GoTo 0

strSQL = "Select [Chart] As oleChart From tblChart Where [ID]=1"

Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL) '("tblChart")

Set objChart = rst![oleChart] ' rst!Fields("Chart").Value '
Set xlbook = xlapp.Workbooks.Add
'******** nothing is not working**************
'Set xlbook = xlapp.Workbooks.Add (objChart)
' xlapp.Workbooks.Open (objChart)
' Set xlbook = GetObject(rst!Fields("Chart").Value)
'****************************************
 
I could do it thru bound object on a form:

Dim oSheet As Object
With Me.oleBoundObj
Set oSheet = .Object.Sheets(2)
Set oSheet = Nothing

.OLETypeAllowed = acOLEEmbedded

End With

It's working well. So, I keep the excel workbook in db. There is no need to
save it anywhere on a disk.

Alex said:
Here is the code I'm trying to implement:

On Error Resume Next
Set xlapp = GetObject(, "Excel.Application")
If Err Then
Set xlapp = CreateObject("Excel.Application")
End If
On Error GoTo 0

strSQL = "Select [Chart] As oleChart From tblChart Where [ID]=1"

Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL) '("tblChart")

Set objChart = rst![oleChart] ' rst!Fields("Chart").Value '
Set xlbook = xlapp.Workbooks.Add
'******** nothing is not working**************
'Set xlbook = xlapp.Workbooks.Add (objChart)
' xlapp.Workbooks.Open (objChart)
' Set xlbook = GetObject(rst!Fields("Chart").Value)
'****************************************

Alex said:
I have a table with a one saved excel workbook with two sheets as a base
table. (I just copied this workbook into this table's ole field). The one
sheet is with data and the another one is with a chart.

I want to open the chart assigning a new data to the data sheet (from query)
so the chart will be changed and save this chart into another users' table
with user's records. So, each individual user had his/her own chart in that
table.

I don't want to save this workbook/charts in any other places except database.

I need to be able demonstrate this chart to a user (it doesn't matter
whether using an access form or using Excel with openning it from the access
table).

How could I implement all this?

Thanks
 
Back
Top