Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Urgent Help on Excel Automation 1

Status
Not open for further replies.

rewdee

Programmer
Aug 17, 2001
295
US
I'm trying to export data to Excel. I cannot use TransferSpreadSheet because I have to highlight certain cells that contain data. I'm using latebinding but am getting similiar results when I use early binding also. I have taken the following code from the Access 97 help file:

Code:
Dim ExcelSheet As Object
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelSheet.Application.Visible = True

'ExcelSheet.Range("A1").Value = "This is column A, row 1"
ExcelSheet.Workbooks.Worksheets.cells(1, 1) = "Please, Please Work"
[\code]

I get "Object Doesn't support this method or property" error message.  Can anyone explain why this code doesn't work?  

I will be eternally grateful, send an X-mas card, praise their name or anyone other name to anyone who can help me with this.

Thanks,
Rewdee
 
Hi!

Try this:

ExcelSheet.Range("A1").FormulaR1C1 = "Whatever you want"

hth
Jeff Bridgham
bridgham@purdue.edu
 
Thanks Jeff but I get the same message.

Here's all the code I've tried:
Code:
Dim ExcelSheet As Object
Set ExcelSheet = CreateObject("Excel.Sheet")
ExcelSheet.Application.Visible = True

'ExcelSheet.Range("A1").Value = "This is column A, row 1"
'ExcelSheet.Workbooks.Worksheets.cells(1, 1) = "Please, Please Work"
ExcelSheet.Range("A1").FormulaR1C1 = "Whatever you want"

I'm goint to try on a different machine because as far as I can tell all the code snippets should work.

Rewdee
 
I don't really know but I know your code won't work on my machine either. You can always do it using the whole Excel object model.

You might use the following:


Dim xl As Object
Dim xlBook As Object
Dim xlSheet As Object

Set xl = CreateObject("Excel.Application")
Set xlBook = xl.Workbooks.Add
Set xlSheet = xlBook.Worksheets("Sheet1")

xl.Visible = True

xlSheet.Cells(1, 1).Value = "Test"


I hope this helps....
 
Well Jitter may your name be praised among those who work with Access Automation. I owe you a X-mas card.

But why does this work, Oh well I'm too busy trying to finish to meet a deadline to find out why.

Thanks,
Rewdee
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top