LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Macro syntax to open file in current explorer folder

Pt 1 : MS Excel 97 SR-2
-----------------------

I would like to use a macro code line starting
Workbooks.OpenText FileName:=".\AmsAll-1.prn", _

to open the tab delimited file "AmsAll-1.prn" in the folder from which
I launch the
Excel application. However the ".\" path qualifier always reverts to
the C: drive, not the K: mapped drive that I access all my project
files from. It is inconvenient to navigate several levels down to the
project from C:\ just to run this one application.

The following does work :
Workbooks.OpenText FileName:="k:.\AmsAll-1.prn", _

however then the macro is not compatible with other engineers
(flame-nix of Three Crub - this is a pre-emptive stop bid to decline
any flames
because of my profession)
who use these project files in different folders (on their C: drives).

I did a little experiment and placed the following ahead of the
OpenText function

curDrive = Left(CurDir, 2)
ChDrive (curDrive)
curDrive = CurDir

turns out that the very first call to CurDir returns
"C:\Documents and Settings\....fubar....

I guess that is something configured to be the default startup folder
for excel, no doubt changeable from tools-options. Even if changing
this to k:\ would not overcome the problem below :

Pt 2 : MS-Excel 2000 9.0.2720
-----------------------------
The engineer currently trying to use this worksheet runs the above
version. On his PC the file is loaded in
C:\AFUBAR\

Yet on his PC the following
Workbooks.OpenText FileName:=".\AmsAll-1.prn", _

throws some or other error, when I really expected it to work ???

All reasonable offers accepted,
Fred.
2006-01-10(Tue)

 
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
Macro to open most current file in folder Tasha Excel Discussion (Misc queries) 6 June 19th 07 03:36 PM
Macro syntax to open file in current explorer folder [email protected] Excel Discussion (Misc queries) 4 January 11th 06 12:07 PM
Excel should open documents in the folder of the current file boxfactory Setting up and Configuration of Excel 0 October 20th 05 03:35 PM
using macro to open every file in a folder wraithlead[_8_] Excel Programming 0 October 27th 04 08:07 AM
using macro to open every file in a folder wraithlead[_7_] Excel Programming 1 October 27th 04 07:19 AM


All times are GMT +1. The time now is 12:29 PM.

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"