formatting excel cells

sando

Registered User.
Local time
Today, 13:06
Joined
Jul 7, 2004
Messages
25
Hi guys,
I just cant get this sucker worked out. I hope someone here can help me.

I want to export a query to excel which I have done. but I want to add formulas to the spreadsheet preferably at the end of the record I have just export.

for the cell I though something like this would be helpful but no avail


Excel.Range("A1").Select
Excel.ActiveCell.Formula = " Hi there"


This is waht i have so far

---------------------------

Dim db As DAO.Database
Dim qDef As DAO.QueryDef
Dim SQL As String

Set db = CurrentDb
SQL = "Select * from [monthly_sales_report]"

db.CreateQueryDef ([Forms]![monthly_report]![Month]), SQL

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, _
([Forms]![monthly_report]![Month]), "C:\3651H\Monthlysales2.xls", True

db.QueryDefs.Delete ([Forms]![monthly_report]![Month])

Set db = Nothing

-------------------------------------

Any help is much appreciated.
 
I would create an excel object to use. (Search for CreateObject in Access Help)

I think this method is refered to as Automation????

Dim xlApp As Object ' Declare variable to hold the reference.

Set xlApp = CreateObject("excel.application")
' You may have to set Visible property to True
' if you want to see the application.
xlApp.Visible = True
' Use xlApp to access Microsoft Excel's
' other objects.
xlApp.Quit ' When you finish, use the Quit method to close
Set xlApp = Nothing ' the application, then release the reference.
 

Users who are viewing this thread

Back
Top Bottom