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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Savecopyas error

Status
Not open for further replies.

leckie

Programmer
Apr 19, 2001
65
GB
Problem with trying to save an excel worksheet

error message "object dos'nt support this property or method."

here is the code I'm using

Dim DB As Database
Dim rs As Recordset
Dim X As Object

Set DB = CurrentDb
Set rs = DB.OpenRecordset("tblSample")
Set X = CreateObject("excel.application")

X.workbooks.Add _
("C:\Sample\Sample.xlt") ' Template
X.sheets("timeplan").Select ' selects sheet
X.activesheet.range("k1").Activate
X.activecell.Offset(0, 0).Value = Me![clientname]
X.activecell.Offset(1, 0).Value = Me![clientid]
X.activesheet.range("a8").Activate
Do While rs.EOF = False
X.activecell.Offset(0, 1).Value = Me![clientid]
X.activecell.Offset(0, 2).Value = rs![Temp Name]
X.activecell.Offset(1, 0).Select
rs.MoveNext
Loop
X.Application.Visible = True
rs.Close

'Save excel sheet
X.SaveCopyAs "C:\sample\SAMPLE.XLS"
X.Application.Quit
End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top