Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Opens directory

I would like a macro that opens the directory D:\VEST\spBackup so that I can
see the files inside.



Any help would be greatly appreciated,



Roger


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Opens directory

Hi Roger,

Roger B. wrote:
I would like a macro that opens the directory D:\VEST\spBackup so
that I can see the files inside.


If you simply want to open the folder in Windows Explorer, you can do
something like this:

Public Sub gShowFolder(rsPath As String)
Dim sh As Object

Set sh = CreateObject("Shell.Application")
sh.Explore rsPath

Set sh = Nothing
End Sub

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Opens directory

Hi Roger

Maybe you want GetOpenFilename
See the VBA help also

Sub test()
Dim FName As Variant
Dim wb As Workbook
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir

MyPath = "D:\VEST\spBackup\"
ChDrive MyPath
ChDir MyPath

FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls")
If FName < False Then
Set wb = Workbooks.Open(FName)
MsgBox "your code"
wb.Close
End If

ChDrive SaveDriveDir
ChDir SaveDriveDir

End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Roger B." wrote in message ...
I would like a macro that opens the directory D:\VEST\spBackup so that I can see the files inside.



Any help would be greatly appreciated,



Roger




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Opens directory

Hi Roger

Maybe you want GetOpenFilename
See the VBA help also

Sub test()
Dim FName As Variant
Dim wb As Workbook
Dim MyPath As String
Dim SaveDriveDir As String

SaveDriveDir = CurDir

MyPath = "D:\VEST\spBackup\"
ChDrive MyPath
ChDir MyPath

FName = Application.GetOpenFilename(filefilter:="Excel Files (*.xls), *.xls")
If FName < False Then
Set wb = Workbooks.Open(FName)
MsgBox "your code"
wb.Close
End If

ChDrive SaveDriveDir
ChDir SaveDriveDir

End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Roger B." wrote in message ...
I would like a macro that opens the directory D:\VEST\spBackup so that I can see the files inside.



Any help would be greatly appreciated,



Roger




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Opens directory

Or this

Sub test()
Shell "explorer.exe C:\Data", vbNormalFocus
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"Jake Marx" wrote in message ...
Hi Roger,

Roger B. wrote:
I would like a macro that opens the directory D:\VEST\spBackup so
that I can see the files inside.


If you simply want to open the folder in Windows Explorer, you can do something like this:

Public Sub gShowFolder(rsPath As String)
Dim sh As Object

Set sh = CreateObject("Shell.Application")
sh.Explore rsPath

Set sh = Nothing
End Sub

--
Regards,

Jake Marx
www.longhead.com


[please keep replies in the newsgroup - email address unmonitored]




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
Excel opens in Autosave.How do I delete it so it opens in Book1? Christine Setting up and Configuration of Excel 1 February 15th 10 02:10 AM
Excel file opens and opens and opens Wanna Learn Excel Discussion (Misc queries) 1 June 9th 09 11:03 PM
Excel opens correct view - web (used frontpg) opens it wrong Jim2003 Excel Discussion (Misc queries) 1 July 27th 05 10:25 PM
Creating a macro that lists directory names within a directory.... Andy Excel Programming 4 November 28th 04 06:13 AM
Check if directory empty OR no of files in directory. Michael Beckinsale Excel Programming 2 December 4th 03 10:12 PM


All times are GMT +1. The time now is 08:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"