open a new excel window

  • Thread starter Thread starter ravindarbtech
  • Start date Start date
R

ravindarbtech

hello friends,
i am using ms access 2003,

i have a form.
when i click on a button,
i should get the new excel window displaying a particular table
values(no need to save the tabel in .xls format, just display is
enough)

so i followed the code below

Dim oExcel As Excel.Application
Dim oWB As Excel.Workbook
Dim oWs As Excel.Worksheet
Set oExcel = New Excel.Application
Set oWs = Excel.Worksheets.Application.ActiveSheet
oExcel.Visible = True
Set oWs = oExcel.ActiveSheet

after this, i should insert the values in the new displayed excel
window
and now i am struck here(even i dont know whether this is correct
procedure)


can any body suggest me what to do
 
hi Ravindar,

when i click on a button,
i should get the new excel window displaying a particular table
values(no need to save the tabel in .xls format, just display is
enough)
can any body suggest me what to do

' Dim ea As Excel.Application
Dim ea As Object

' Set ea = New Excel.Application
Set ea = CreateObject("Excel.Application")
ea.Visible = True

ea.Workbooks.Add
ea.Range("D3").Value = "yourValue"

Use late binding in the release version, as it avoids some problems
regarding different Office installations.

You may also take a look at

ea.Range().CopyFromRecordset()

this can copy an entire recordset, but has some limitions in size for
the fields (Memo fields > 255B) and the row number (<64k)) copied.

If you don't know what to do: Open Excel and record a macro resampling
your desired actions. This code can normally be run by copy'n'paste into

With ea
'.copied macro
End With


mfG
--> stefan <--
 
hi Ravindar,
' Dim ea As Excel.Application
Dim ea As Object

' Set ea = New Excel.Application
Set ea = CreateObject("Excel.Application")
ea.Visible = True

ea.Workbooks.Add
ea.Range("D3").Value = "yourValue"


ea.Range().CopyFromRecordset()

this can copy an entire recordset, but has some limitions in size for
the fields (Memo fields > 255B) and the row number (<64k)) copied.

If you don't know what to do: Open Excel and record a macro resampling
your desired actions. This code can normally be run by copy'n'paste into

With ea
'.copied macro
End With

mfG
--> stefan <--





Dim db As Database

Dim ea As Excel.Application
Dim rs As Recordset

Set ea = New Excel.Application
Set ea = CreateObject("Excel.Application")
Set db = CurrentDb
ea.Visible = True
ea.Workbooks.Add
Set rs = db.OpenRecordset("SELECT Indicator_Values.year as yea,
Indicator_Values.[Energy use per $1 GDP (PPP)(converted unit)]as eng
FROM Indicator_Values;")
If rs.RecordCount > 0 Then
rs.GetRows
MsgBox (rs.RecordCount)
rs.MoveFirst

for i=0 to rs.Recount-1






next
end if



what should i do in the for loop to enter the values in the excel
cells?
 
hi Ravindar,

Dim db As Database
Dim db As DAO.Database
Dim ea As Excel.Application
Dim rs As Recordset
Dim rs As DAO.Recordset
Set ea = New Excel.Application
Set db = CurrentDb
ea.Visible = True
ea.Workbooks.Add
Set rs = db.OpenRecordset("SELECT Indicator_Values.year as yea,
Indicator_Values.[Energy use per $1 GDP (PPP)(converted unit)]as eng
FROM Indicator_Values;")
Didn't i wrote something about CopyFromRecordset?

ea.Range("A1").CopyFromRecordset rs


mfG
--> stefan <--
 
Back
Top