Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
macro that opens file named in cell doesnt work
I wrote a macro that should open file with the name specified in cell
B8. It worked well yesterday but today I opened the file and the macro doesnt work at all. Could anyone tell whats wrong with the code. Here it is the code: Sub Import() Sheets("Instruction").Select Range("B8").Select filetext = Selection.Value & ".xls" directory = ".\" Workbooks.Open directory & filetext End Sub |
#2
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
macro that opens file named in cell doesnt work
Try setting directory to the full path.
-- Gary''s Student - gsnu2007a "Illuminati" wrote: I wrote a macro that should open file with the name specified in cell B8. It worked well yesterday but today I opened the file and the macro doesnt work at all. Could anyone tell whats wrong with the code. Here it is the code: Sub Import() Sheets("Instruction").Select Range("B8").Select filetext = Selection.Value & ".xls" directory = ".\" Workbooks.Open directory & filetext End Sub |
#3
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
macro that opens file named in cell doesnt work
On 15 Lis, 12:15, Gary''s Student
wrote: Try setting directory to the full path. -- Gary''s Student - gsnu2007a But I need this macro to open file from folder that the file with macro is. Btw, I have tried to put the name of the folder but it still doesn't work. It works when I put the exact path of the file with the name (not reffering to the cell). Please help, I have tried to modify the code and put sth like this: Workbooks.Open Filename:= _ ".\" & Range("B8").Value & ".xls" But the error is still the same: run-time error '1004' |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Formula doesnt work when copy in different cell | Excel Discussion (Misc queries) | |||
File opens with Enable or Disable Macro | Excel Discussion (Misc queries) | |||
macro from excel 97 that doesnt work in excel 2003 (help) | Excel Discussion (Misc queries) | |||
My first macro - doesnt work - function not recognised | Excel Worksheet Functions | |||
Assign Macro to button in Excel doesnt work Any ideas? | Excel Discussion (Misc queries) |