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

help with code please 1

Status
Not open for further replies.

jewel

Technical User
May 23, 2001
158
NZ
hi all

I use to use NT/Office 97 and the following code worked fine on a command button

Private Sub excel_Click()
Dim xlapp As excel.Application
Dim xlbook As excel.Workbook
Dim xlsheet As excel.Worksheet

Set xlapp = New excel.Application
xlapp.Visible = True
Set xlbook = xlapp.Workbooks.Open("H:\xxxx\xxxx\Charges\ITBudget2003.xls")
Set xlsheet = xlbook.Worksheets("sheet1")
'
' Updating monthly budget figures

can someone please help with the new code - it seems it is the first two lines in the debug it is rejecting
I am now using Windows 2000/Office 2000

have tried in the help but cant seem to find it exactly

thanks
 
The code as provided works fine for me in a Win2K, Access 2000 environment, providing:

(a) I have the Microsoft Excel 9.0 Object Library referenced
(b) The "H:\xxxx\xxxx\Charges\ITBudget2003.xls" spreadsheet reference exists and is accessable in the file system.
(c) The "sheet1" sheet reference exists as a sheet on the nominated spreadsheet.

I did my testing in a global module, but shouldnt make any difference from a command button.

If you're still having a problem, perhaps you should provide us with further detail on the nature of the problem; eg. error messages that you are receiving,



Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
thank you for your help Steve, I did go an check the references after my post and you were right on there - sorry I should have done that first, then we had a problem with the path - but have finally sorted that out now as well. thanks heaps for your quick reply. Dianne
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top