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

access module error

Status
Not open for further replies.

scrappe7

Technical User
Jul 30, 2001
82
US
with the help of you guys i ahve a access module that looks like this:

Public Function blnExcelFromAccess() As Boolean

Dim appExcel As Excel.Application

' Link to Excel using automation
Set appExcel = CreateObject("Excel.Application")

' So you can watch what's happening...
appExcel.Visible = True

' Open Dummy File
appExcel.Workbooks.Open "G:\New Ideas\Dummy.xls"

' Open Management Action Plan
appExcel.Workbooks.Open "G:\New Ideas\Management Action Plan.xls"

' Calculate ('read' values from dummy file
appExcel.Calculate

' Close the dummy workbook (without saving changes)
appExcel.Workbooks("G:\New Ideas\Dummy.xls").Close False

' Done with Excel (omit if you want to leave Excel open)
appExcel.Quit

End Function

When i run this form an access macro the line :

'Close the dummy workbook (without saving changes)
appExcel.Workbooks("G:\New Ideas\Dummy.xls").Close False

gives me an subscript error 9, out of range!

all i want is to close an excel file from access? anyone know the error?
Also, is there a way to run macro's in an excel worksheet that is being opened by acces from the module or macro screen???

THANK YOU

 
Just a hunch. (read -> not a lot of thought put into it)

Have you tried opening the "Management Action Plan" and then the "Dummy" file?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top