LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default troubles with the Workbooks.Open method in Excel 97

Hi! I have troubles with the Workbooks.Open method.
I want to open a file (power_budget.xls) from a main workbook with a userform menu (main.xls). I used Workbook.Open("power_budget.xls") method to open it and it works well, but now the problem arises.
power_budget.xls should ask the user for the path of an excel file containing data to be imported. I stored the sub to show the form that asks for the path in ThisWorkbook with an event sub like this one:
Private Sub Workbook_Open()
userform.show
End sub
When the CommandButton I put in the userform is clicked, another event Sub should open the data file with a call like this:
Set source = Workbook.Open("datafile.xls")
then read the data and import them in power_budget.xls, but that doens't happen!
When I ran the debugger I noticed that the source doesn't contain "datafile.xls" but "power_budget.xls" again, and I can't understand why this happens and how to fix it. I know the code stored in power_budget.xls is correct, because when I open it directly (without using main.xls), everything works in the right way.
Can anyone help with this problem?
10x everybody
Amarth
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
When I open Excel, workbooks open automatically. How can I stop t Rhealbird Excel Discussion (Misc queries) 2 February 23rd 06 10:08 AM
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed Frank Jones Excel Programming 2 June 15th 04 03:21 AM
Open method of workbooks fails when Excel is hosted in IE [email protected] Excel Programming 5 January 30th 04 02:19 AM
EXCEL.exe stays open after Quit method in an HTA myriams9 Excel Programming 5 December 4th 03 07:06 AM
Open Method of workbooks class failed kiran[_2_] Excel Programming 0 November 6th 03 09:58 PM


All times are GMT +1. The time now is 03:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"