ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA does not open workbook (https://www.excelbanter.com/excel-programming/274432-re-vba-does-not-open-workbook.html)

Chip Pearson

VBA does not open workbook
 
Etienne

Most likely, the current path isn't correct. Try something like

Workbooks.Open Filename:="C:\full\path\workbook.xls"
' or
ChDrive "C:"
ChDir "C:\Full\Path"
Workbooks.Open Filename:="workbookname.xls"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Etienne" wrote in
message ...
Here is the culprit code:
Workbooks.Open "workbookname.xls"
I tried
Workbooks.Open Filename:="workbookname.xls"
but it does not work

Thanks,

Etienne
-----Original Message-----
What do you mean when you say that VBA doesn't recognize

the name
of the file? Perhaps you could post the code that is

causing the
problem.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"etienne" wrote

in
message ...
Any insight as to why a VBA macro would not recognize

the
name of an existing Excel workbook? Somehow I can make

the
macro recognize the name by manually using 'save as'

with
the same name.
The macro does save the workbook when it has run
successfully by using the command 'ActiveWorkbook.Close
SaveChanges:=True'

Thanks





.




etienne

VBA does not open workbook
 
thanks, Etienne
-----Original Message-----
Etienne

Most likely, the current path isn't correct. Try

something like

Workbooks.Open Filename:="C:\full\path\workbook.xls"
' or
ChDrive "C:"
ChDir "C:\Full\Path"
Workbooks.Open Filename:="workbookname.xls"


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Etienne" wrote

in
message ...
Here is the culprit code:
Workbooks.Open "workbookname.xls"
I tried
Workbooks.Open Filename:="workbookname.xls"
but it does not work

Thanks,

Etienne
-----Original Message-----
What do you mean when you say that VBA doesn't

recognize
the name
of the file? Perhaps you could post the code that is

causing the
problem.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"etienne"

wrote
in
message ...
Any insight as to why a VBA macro would not recognize

the
name of an existing Excel workbook? Somehow I can

make
the
macro recognize the name by manually using 'save as'

with
the same name.
The macro does save the workbook when it has run
successfully by using the

command 'ActiveWorkbook.Close
SaveChanges:=True'

Thanks





.



.



All times are GMT +1. The time now is 01:23 PM.

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