See how this works for ya:
Option Explicit
Option Compare Database
Private objExcel As Excel.Application
Private xlWB As Excel.Workbook
Private xlWS As Excel.Worksheet
Private Sub Command0_Click()
' Use this to make sure your variables are defined
' One way to be able to use these objects throughout the Module is to
Declare them here, and not in a Sub
Dim strFile As String
strFile = "C:\Documents and Settings\Excel\Desktop\Book1.xls"
' Opens Excel and makes it Visible
Set objExcel = New Excel.Application
objExcel.Visible = True
' Opens up a Workbook
Set xlWB = objExcel.Workbooks.Open(strFile)
' Sets the Workseet to the last active sheet - Better to use the commented
version and use the name of the sheet.
Set xlWS = xlWB.ActiveSheet
' Set xlWS = xlWB("Sheet1")
With xlWS ' You are now working with the Named file and the named worksheet
' Your Excel code begins here
Sheets("Sheet1").Select
Sheets("Sheet1").Name = "Ryan1"
Sheets("Sheet2").Select
Sheets("Sheet2").Name = "Ryan2"
Sheets("Sheet3").Select
Sheets("Sheet3").Name = "Ryan3"
End With
' Close and Cleanup
xlWB.Save
xlWB.Close
End Sub