Thread: Macro in 2000
View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.programming
kounoike[_2_] kounoike[_2_] is offline
external usenet poster
 
Posts: 126
Default Macro in 2000

"Naman.Patel" wrote in message
...
"Arvi Laanemets"

your suggestion might be working but my problem is tha I want to select a
folder from dialog box which can work in both 2000 and XP and I need it's
title my own.


Is this work for you?

Sub test()
Dim str As String
str = getFoldername
MsgBox "folder: " & str
End Sub

Function getFoldername() As String
Dim objShell As Object
Dim ssfWINDOWS As Long
Dim objFolder As Object

Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Select folder", 0)
If (Not objFolder Is Nothing) Then
getFoldername = objFolder.Self.Path
Else
getFoldername = ""
End If
Set objFolder = Nothing
Set objShell = Nothing
End Function

keizi