LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,071
Default VBA - Open Folder Where .xls Resides

Use ChDir and ChDrive together with thisworkbook.path (or
activeworkbook.path as appropriate).

Option Explicit

Sub testIt()
Dim SavedPathname As String

MsgBox Application.GetOpenFilename()
SavedPathname = CurDir

ChDir ThisWorkbook.Path
ChDrive ThisWorkbook.Path
MsgBox Application.GetOpenFilename()

ChDir SavedPathname
ChDrive SavedPathname
MsgBox Application.GetOpenFilename()
End Sub

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions

In article ,
says...

Group,
Another novice question. When I open a file I use the following
code. The first use of my spreadsheet always begins in a folder other
than where the files are located. Once I navigate to the folder where
my files are located, Excel remembers the path. Then each subsequent
opening and Excel opens that folder. Is there a way to always open the
folder where my spreadsheet is located? Assume my files are located in
folder c:\MPI .




fn2 = Application.GetOpenFilename("Current MPI File,*.mpi", 1,
"Select NEW MPI File To Open", , False)


Tony


--
ajocius
------------------------------------------------------------------------
ajocius's Profile:
http://www.excelforum.com/member.php...o&userid=17695
View this thread: http://www.excelforum.com/showthread...hreadid=470534


 
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
Identify the row in which a MAX number in a column resides BarDoomed Excel Worksheet Functions 7 June 5th 08 08:23 PM
VLOOKUP when a range resides in Column A rpalarea Excel Discussion (Misc queries) 1 June 19th 07 08:40 PM
XL 2007: Pivot Refresh slow when data resides in another workbook funnybroad Excel Discussion (Misc queries) 1 May 31st 07 07:31 AM
open file from folder save in new folder tim64[_3_] Excel Programming 20 June 17th 05 07:58 PM
Open files in folder - skip if already open Steph[_3_] Excel Programming 6 March 25th 05 06:49 PM


All times are GMT +1. The time now is 02:14 AM.

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"