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

below is the code I have used to to open the open file
dialog and display on Excel type files. It works
correctly, however if I select and open a file in the
dialog box, I want combobox3 to show ONLY the filename,
NOT the file name including path. Currently the below
code shows the full path in combobox3.
How do I do this?

If ComboBox3.Value = "Export from Un-Opened Workbook..."
Then
'MsgBox ("Navigate to source workbook and then click "
& "OK")
FileToOpen = Application _
.GetOpenFilename("All Microsoft Excel Files
(*.xl;*.xls;*.xla;*.xlt;*.xlm;*.xlc;*.xlw;*.xll;*. xlb),*.xl
;*.xls;*.xla;*.xlt;*.xlm;*.xlc;*.xlw;*.xll;*.xlb,E xcel
Files (*.xls),*.xls,Add-In Files (*.xla),*.xla")
If FileToOpen = False Then
GoTo SelectWorkbook
Else
Workbooks.Open FileToOpen
Unload Me
PublishBackupExport.Show
ComboBox3.Value = ComboBox3.Value
GoTo SelectWorkbook
End If
End If


Thank you
Todd Huttenstine
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default GetOpenFilename

Hi
have a look at the InStrRev method. Use this to find the
last '\' in your return value and use Mid/Right to get
only the relevant part (Works for Excel 2000+)

-----Original Message-----
below is the code I have used to to open the open file
dialog and display on Excel type files. It works
correctly, however if I select and open a file in the
dialog box, I want combobox3 to show ONLY the filename,
NOT the file name including path. Currently the below
code shows the full path in combobox3.
How do I do this?

If ComboBox3.Value = "Export from Un-Opened Workbook..."
Then
'MsgBox ("Navigate to source workbook and then click "
& "OK")
FileToOpen = Application _
.GetOpenFilename("All Microsoft Excel Files

(*.xl;*.xls;*.xla;*.xlt;*.xlm;*.xlc;*.xlw;*.xll;*. xlb),*.xl
;*.xls;*.xla;*.xlt;*.xlm;*.xlc;*.xlw;*.xll;*.xlb, Excel
Files (*.xls),*.xls,Add-In Files (*.xla),*.xla")
If FileToOpen = False Then
GoTo SelectWorkbook
Else
Workbooks.Open FileToOpen
Unload Me
PublishBackupExport.Show
ComboBox3.Value = ComboBox3.Value
GoTo SelectWorkbook
End If
End If


Thank you
Todd Huttenstine
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default GetOpenFilename

I used the below code:

If ComboBox3.Value = "Export from Un-Opened Workbook..."
Then
'MsgBox ("Navigate to source workbook and then click "
& "OK")
FileToOpen = Application _
.GetOpenFilename("All Microsoft Excel Files
(*.xl;*.xls;*.xla;*.xlt;*.xlm;*.xlc;*.xlw;*.xll;*. xlb),*.xl
;*.xls;*.xla;*.xlt;*.xlm;*.xlc;*.xlw;*.xll;*.xlb,E xcel
Files (*.xls),*.xls,Add-In Files (*.xla),*.xla")
If FileToOpen = False Then
GoTo SelectWorkbook
Else
Workbooks.Open FileToOpen
ComboBox3.AddItem ActiveWorkbook.Name
ComboBox3.Value = ActiveWorkbook.Name
End If
End If

I will also look at the InStrRev as you suggested. Thank
you. There are mahy times when I need to do that sort of
thing.



-----Original Message-----
Hi
have a look at the InStrRev method. Use this to find the
last '\' in your return value and use Mid/Right to get
only the relevant part (Works for Excel 2000+)

-----Original Message-----
below is the code I have used to to open the open file
dialog and display on Excel type files. It works
correctly, however if I select and open a file in the
dialog box, I want combobox3 to show ONLY the filename,
NOT the file name including path. Currently the below
code shows the full path in combobox3.
How do I do this?

If ComboBox3.Value = "Export from Un-Opened Workbook..."
Then
'MsgBox ("Navigate to source workbook and then click "
& "OK")
FileToOpen = Application _
.GetOpenFilename("All Microsoft Excel Files


(*.xl;*.xls;*.xla;*.xlt;*.xlm;*.xlc;*.xlw;*.xll;*. xlb),*.xl
;*.xls;*.xla;*.xlt;*.xlm;*.xlc;*.xlw;*.xll;*.xlb ,Excel
Files (*.xls),*.xls,Add-In Files (*.xla),*.xla")
If FileToOpen = False Then
GoTo SelectWorkbook
Else
Workbooks.Open FileToOpen
Unload Me
PublishBackupExport.Show
ComboBox3.Value = ComboBox3.Value
GoTo SelectWorkbook
End If
End If


Thank you
Todd Huttenstine
.

.

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
GetOpenFileName Greg Bloom Excel Programming 2 February 9th 04 04:09 PM
GetOpenFilename Greg Bloom Excel Programming 0 February 9th 04 03:32 PM
GetOpenFilename Wolfgang Excel Programming 1 February 6th 04 07:37 PM
getopenfilename inquirer Excel Programming 1 December 3rd 03 11:37 AM
GetOpenFilename Hasan Cansü Excel Programming 0 September 24th 03 01:32 PM


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