Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Applications / Excel / July 2007



Tip: Looking for answers? Try searching our database.

Workbook.open failure

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
MattJ - 26 Jul 2007 15:46 GMT
I have a slight issue when trying to run a macro with the workbook.open
command.
The problem is that I cannot open an excel file without going throught he
whole filepath usin file/open in excel.

Is there anyway in which I can just open a file without having to "show"
excel the exact file path everytime i wish to open a certain workbook?

Many thanks in advance
Matt
Bob Greenblatt - 26 Jul 2007 16:06 GMT
On 7/26/07 10:46 AM, in article
6F1DBEC9-EE73-4E86-A54A-8F02C2075298@microsoft.com, "MattJ"

> I have a slight issue when trying to run a macro with the workbook.open
> command.
[quoted text clipped - 6 lines]
> Many thanks in advance
> Matt
Excel has a default directory. It is usually the directory from which the
first file opened belongs. It is always a good idea to specify the full path
name to a file. If your macro statement says workbooks.open filename:=...,
specify the full path here and excel will not present a dialog.

Signature

Bob Greenblatt [MVP], Macintosh
bobgreenblattATmsnDOTcom

JE McGimpsey - 26 Jul 2007 16:13 GMT
> I have a slight issue when trying to run a macro with the workbook.open
> command.
[quoted text clipped - 3 lines]
> Is there anyway in which I can just open a file without having to "show"
> excel the exact file path everytime i wish to open a certain workbook?

First, I assume you mean the Workbooks.Open method.

XL has to know what path to tell MacOS to look in for the file.

If you don't specify a path, it looks in the path stored in the
Application.CurDir property. You can change this folder using the ChDir
statment, but that then requires you to specify the entire path (though
you can move relative to the current directory using ChDir "..", or by
specifying a folder in the current folder).

You can also use the folder your workbook is in as a reference. For
instance if the file you want to open, say "Test.xls", is in the same
folder as the workbook running the Workbooks.Open command, you can use
something like

 Dim sFullPath As String
 sFullPath = ThisWorkbook.Path & Application.PathSeparator & "Test.xls"
 Workbooks.Open sFullPath
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.