A
Al
I am using Access 97. I am trying to do the following:
1) open an existing file in excle
2) insert a row on the top
3) fill in range A1:A4 with text
4) close excel
here is the code:
********************** Start ******************
Dim XL As Excel.Workbook,As String, strFile As String
strFile = "c:\InsTst.xls"
Call Shell("""C:\Program Files\Microsoft
Office\Office\EXCEL.EXE"" /automation", 1)
Set XL = GetObject(strFile, "Excel.Sheet")
XL.Application.Visible = True 'Make Excel
Visible.
XL.Application.Windows(strFile).Visible = True
Make the Workbook visible.
Worksheets("Sheet1").Rows(1).Insert
Range("A1") = "Subject"
Range("A2") = "usEquiv"
Range("A3") = "Level"
Range("A4") = "Grade"
XL.Application.Run "Save"
XL.Application.Quit
Set XL = Nothing
********************** End ******************
The code break on
XL.Application.Windows(strFile).Visible = True Make the
Workbook visible.
and it gives me script is out of range?
what is the wrong with my code and how can I accomplish
what I need in an easy way. thanks
Al
1) open an existing file in excle
2) insert a row on the top
3) fill in range A1:A4 with text
4) close excel
here is the code:
********************** Start ******************
Dim XL As Excel.Workbook,As String, strFile As String
strFile = "c:\InsTst.xls"
Call Shell("""C:\Program Files\Microsoft
Office\Office\EXCEL.EXE"" /automation", 1)
Set XL = GetObject(strFile, "Excel.Sheet")
XL.Application.Visible = True 'Make Excel
Visible.
XL.Application.Windows(strFile).Visible = True
Make the Workbook visible.
Worksheets("Sheet1").Rows(1).Insert
Range("A1") = "Subject"
Range("A2") = "usEquiv"
Range("A3") = "Level"
Range("A4") = "Grade"
XL.Application.Run "Save"
XL.Application.Quit
Set XL = Nothing
********************** End ******************
The code break on
XL.Application.Windows(strFile).Visible = True Make the
Workbook visible.
and it gives me script is out of range?
what is the wrong with my code and how can I accomplish
what I need in an easy way. thanks
Al