ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro doesnt run (https://www.excelbanter.com/excel-programming/401319-macro-doesnt-run.html)

Illuminati

macro doesnt run
 

I wrote macro that opens file with the name from the cell B8. The file
is placed in the same folder as the file with macro. The macro worked
few days ago, but now does not work at all.
Whats wrong with it ?

Here is the code:

Sheets("Instruction").Select
Workbooks.Open Filename:= _
".\" & Range("B8").Value & ".xls"

The error 1004 occurs when I try to run it (cannot find the file), but
file is placed for sure. Actually it works when I put the full name
and path where the file is placed, but it doesnt satisfy me.










Dave Peterson

macro doesnt run
 
Depending on where the code is, maybe the code isn't picking up the correct B8
cell.

Sheets("Instruction").Select
Workbooks.Open Filename:=".\" & sheets("instruction").Range("B8").Value & ".xls"

Or it may be a problem with what's in B8--is it a number/time/date???



Illuminati wrote:

I wrote macro that opens file with the name from the cell B8. The file
is placed in the same folder as the file with macro. The macro worked
few days ago, but now does not work at all.
Whats wrong with it ?

Here is the code:

Sheets("Instruction").Select
Workbooks.Open Filename:= _
".\" & Range("B8").Value & ".xls"

The error 1004 occurs when I try to run it (cannot find the file), but
file is placed for sure. Actually it works when I put the full name
and path where the file is placed, but it doesnt satisfy me.


--

Dave Peterson


All times are GMT +1. The time now is 02:40 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com