Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Need directory path without filename

Hi,

Is there a way to find out only the directory path without filename
using VBA macro. I came across macros that will spit out only filename
from the full path.

Example: D:\Documents\ExcelPrograms\

Any help on this will be greatly appreciated.

Regards
Shilpa

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Need directory path without filename

Use the Path property of the Workbook object.

Debug.Print ThisWorkbook.Path


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




wrote in message
oups.com...
Hi,

Is there a way to find out only the directory path without
filename
using VBA macro. I came across macros that will spit out only
filename
from the full path.

Example: D:\Documents\ExcelPrograms\

Any help on this will be greatly appreciated.

Regards
Shilpa



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Need directory path without filename

of what?

for an open excel file

ActiveWorkbook.Path

or
ThisWorkbook.Path

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
Hi,

Is there a way to find out only the directory path without filename
using VBA macro. I came across macros that will spit out only filename
from the full path.

Example: D:\Documents\ExcelPrograms\

Any help on this will be greatly appreciated.

Regards
Shilpa



  #4   Report Post  
Posted to microsoft.public.excel.programming
ben ben is offline
external usenet poster
 
Posts: 232
Default Need directory path without filename

easy :)
msgbox activeworkbook.path
or
msgbox thisworkbook.path
or
workbooks("myworkbook.xls").path
if it returns null then it has not yet been saved
ben

--
When you lose your mind, you free your life.


" wrote:

Hi,

Is there a way to find out only the directory path without filename
using VBA macro. I came across macros that will spit out only filename
from the full path.

Example: D:\Documents\ExcelPrograms\

Any help on this will be greatly appreciated.

Regards
Shilpa


Reply
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
http://CannotDeleteFile.net - Cannot Delete File? Try Long Path ToolFilename is too long? Computer Complaining Your Filename Is Too Long? TheLong Path Tool Can Help While most people can go about their businessblissfully unaware of the Windo Max Loger Excel Discussion (Misc queries) 0 June 14th 11 04:30 PM
hyperlink to directory folder while highlighting filename locojester Excel Discussion (Misc queries) 0 February 10th 10 12:01 AM
Dynamic directory path Newbie Excel Discussion (Misc queries) 1 April 24th 06 04:56 PM
Target directory & Path Param Excel Worksheet Functions 0 March 28th 06 01:52 AM
Set The Directory to the Current WB Path Richy Excel Programming 2 February 29th 04 06:54 PM


All times are GMT +1. The time now is 10: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"