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

I am trying to get the foldername into a textbox of my gui by using the
FileDialog box. I have some problem to get it to work:


Public Sub ReadDirectoryNames()
Dim FileName As Variant
Dim Filt As String, Title As String
Dim Response As Integer

' Set Drive letter
ChDrive "C:\"
' Set to Specified Path\Folder
ChDir "C:\plot\"

FilterIndex = 5
' Set Dialogue Box Caption
Title = "Kims file selector"
' Get FileName
FileName = Application.FileDialog(Title:=Title)
' Exit if Dialogue box cancelled
If FileName = False Then
Response = MsgBox("No File was selected", vbOKOnly & vbCritical,
"Selection Error")
Exit Sub
End If
' Display Full Path & File Name
Response = MsgBox("You selected " & FileName, vbInformation, "Proceed")

GUI.TextBoxDirectoryName.Text = FileName


Call ReadText(FileName)
GUI.TabbedPane.Pages(2).Visible = True



End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Reading directory names

Try giving FileDialog a type rather than a Title.
--
Gary''s Student - gsnu200810


"Kim Skatun" wrote:

I am trying to get the foldername into a textbox of my gui by using the
FileDialog box. I have some problem to get it to work:


Public Sub ReadDirectoryNames()
Dim FileName As Variant
Dim Filt As String, Title As String
Dim Response As Integer

' Set Drive letter
ChDrive "C:\"
' Set to Specified Path\Folder
ChDir "C:\plot\"

FilterIndex = 5
' Set Dialogue Box Caption
Title = "Kims file selector"
' Get FileName
FileName = Application.FileDialog(Title:=Title)
' Exit if Dialogue box cancelled
If FileName = False Then
Response = MsgBox("No File was selected", vbOKOnly & vbCritical,
"Selection Error")
Exit Sub
End If
' Display Full Path & File Name
Response = MsgBox("You selected " & FileName, vbInformation, "Proceed")

GUI.TextBoxDirectoryName.Text = FileName


Call ReadText(FileName)
GUI.TabbedPane.Pages(2).Visible = True



End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Reading directory names

How do u suugest to use a type? I want to have the title as well, is this not
possible? Also I was interested in starting the directory selector at a
spesific location. c:\plot\

"Gary''s Student" wrote:

Try giving FileDialog a type rather than a Title.
--
Gary''s Student - gsnu200810


"Kim Skatun" wrote:

I am trying to get the foldername into a textbox of my gui by using the
FileDialog box. I have some problem to get it to work:


Public Sub ReadDirectoryNames()
Dim FileName As Variant
Dim Filt As String, Title As String
Dim Response As Integer

' Set Drive letter
ChDrive "C:\"
' Set to Specified Path\Folder
ChDir "C:\plot\"

FilterIndex = 5
' Set Dialogue Box Caption
Title = "Kims file selector"
' Get FileName
FileName = Application.FileDialog(Title:=Title)
' Exit if Dialogue box cancelled
If FileName = False Then
Response = MsgBox("No File was selected", vbOKOnly & vbCritical,
"Selection Error")
Exit Sub
End If
' Display Full Path & File Name
Response = MsgBox("You selected " & FileName, vbInformation, "Proceed")

GUI.TextBoxDirectoryName.Text = FileName


Call ReadText(FileName)
GUI.TabbedPane.Pages(2).Visible = True



End Sub

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

I asked a similar question and got several good suggestions:

http://groups.google.com/group/micro...40f6f68 dc896
--
Gary''s Student - gsnu200810


"Kim Skatun" wrote:

How do u suugest to use a type? I want to have the title as well, is this not
possible? Also I was interested in starting the directory selector at a
spesific location. c:\plot\

"Gary''s Student" wrote:

Try giving FileDialog a type rather than a Title.
--
Gary''s Student - gsnu200810


"Kim Skatun" wrote:

I am trying to get the foldername into a textbox of my gui by using the
FileDialog box. I have some problem to get it to work:


Public Sub ReadDirectoryNames()
Dim FileName As Variant
Dim Filt As String, Title As String
Dim Response As Integer

' Set Drive letter
ChDrive "C:\"
' Set to Specified Path\Folder
ChDir "C:\plot\"

FilterIndex = 5
' Set Dialogue Box Caption
Title = "Kims file selector"
' Get FileName
FileName = Application.FileDialog(Title:=Title)
' Exit if Dialogue box cancelled
If FileName = False Then
Response = MsgBox("No File was selected", vbOKOnly & vbCritical,
"Selection Error")
Exit Sub
End If
' Display Full Path & File Name
Response = MsgBox("You selected " & FileName, vbInformation, "Proceed")

GUI.TextBoxDirectoryName.Text = FileName


Call ReadText(FileName)
GUI.TabbedPane.Pages(2).Visible = True



End Sub

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Reading directory names

Its a pretty big code trunk just to be able to set preselected folder
location....


"Gary''s Student" wrote:

I asked a similar question and got several good suggestions:

http://groups.google.com/group/micro...40f6f68 dc896
--
Gary''s Student - gsnu200810


"Kim Skatun" wrote:

How do u suugest to use a type? I want to have the title as well, is this not
possible? Also I was interested in starting the directory selector at a
spesific location. c:\plot\

"Gary''s Student" wrote:

Try giving FileDialog a type rather than a Title.
--
Gary''s Student - gsnu200810


"Kim Skatun" wrote:

I am trying to get the foldername into a textbox of my gui by using the
FileDialog box. I have some problem to get it to work:


Public Sub ReadDirectoryNames()
Dim FileName As Variant
Dim Filt As String, Title As String
Dim Response As Integer

' Set Drive letter
ChDrive "C:\"
' Set to Specified Path\Folder
ChDir "C:\plot\"

FilterIndex = 5
' Set Dialogue Box Caption
Title = "Kims file selector"
' Get FileName
FileName = Application.FileDialog(Title:=Title)
' Exit if Dialogue box cancelled
If FileName = False Then
Response = MsgBox("No File was selected", vbOKOnly & vbCritical,
"Selection Error")
Exit Sub
End If
' Display Full Path & File Name
Response = MsgBox("You selected " & FileName, vbInformation, "Proceed")

GUI.TextBoxDirectoryName.Text = FileName


Call ReadText(FileName)
GUI.TabbedPane.Pages(2).Visible = True



End Sub

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
Reading tabs names smaruzzi Excel Discussion (Misc queries) 2 October 7th 06 01:41 PM
Reading Active Directory from VBA? Linn Kubler Excel Programming 1 January 6th 06 06:18 AM
Reading Contents of a Directory Nigel Excel Programming 2 December 5th 05 05:57 PM
Changing directory names Norman Jones Excel Programming 1 October 18th 05 12:48 PM
Creating a macro that lists directory names within a directory.... Andy Excel Programming 4 November 28th 04 06:13 AM


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