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

Below is a code that attaches "\My Stats.xls" to the end
of values in textbox6. It works fine, accept when a user
selects only a drive and then clicks OK. For example, if
I were to select the C drive it puts 2 // in front and
this makes the path invalid(C:\\My Stats.xls), however it
works fine if I select a drive and then a folder.

TextBox6.Value = GetDirectory & "\My Stats.xls"

How should I fix this?
Thank you


Todd Huttenstine

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default File Path Problem

Hi Todd,

Something like this should work for you:

Sub demo()
Dim sDir As String

sDir = GetDirectory
If Right$(sDir, 1) = Application.PathSeparator Then _
sDir = Left$(sDir, Len(sDir) - 1)

TextBox6.Text = sDir & "\My Stats.xls"
End Sub

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

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


Todd Huttenstine wrote:
Below is a code that attaches "\My Stats.xls" to the end
of values in textbox6. It works fine, accept when a user
selects only a drive and then clicks OK. For example, if
I were to select the C drive it puts 2 // in front and
this makes the path invalid(C:\\My Stats.xls), however it
works fine if I select a drive and then a folder.

TextBox6.Value = GetDirectory & "\My Stats.xls"

How should I fix this?
Thank you


Todd Huttenstine

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default File Path Problem

thanks, that worked great.

Todd Huttenstine
-----Original Message-----
Hi Todd,

Something like this should work for you:

Sub demo()
Dim sDir As String

sDir = GetDirectory
If Right$(sDir, 1) = Application.PathSeparator Then _
sDir = Left$(sDir, Len(sDir) - 1)

TextBox6.Text = sDir & "\My Stats.xls"
End Sub

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address

unmonitored]


Todd Huttenstine wrote:
Below is a code that attaches "\My Stats.xls" to the end
of values in textbox6. It works fine, accept when a

user
selects only a drive and then clicks OK. For example,

if
I were to select the C drive it puts 2 // in front and
this makes the path invalid(C:\\My Stats.xls), however

it
works fine if I select a drive and then a folder.

TextBox6.Value = GetDirectory & "\My Stats.xls"

How should I fix this?
Thank you


Todd Huttenstine

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 237
Default File Path Problem

thanks, that worked great.

Todd Huttenstine
-----Original Message-----
Hi Todd,

Something like this should work for you:

Sub demo()
Dim sDir As String

sDir = GetDirectory
If Right$(sDir, 1) = Application.PathSeparator Then _
sDir = Left$(sDir, Len(sDir) - 1)

TextBox6.Text = sDir & "\My Stats.xls"
End Sub

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address

unmonitored]


Todd Huttenstine wrote:
Below is a code that attaches "\My Stats.xls" to the end
of values in textbox6. It works fine, accept when a

user
selects only a drive and then clicks OK. For example,

if
I were to select the C drive it puts 2 // in front and
this makes the path invalid(C:\\My Stats.xls), however

it
works fine if I select a drive and then a folder.

TextBox6.Value = GetDirectory & "\My Stats.xls"

How should I fix this?
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
File Path Too Long? Not Anymore! Check out Long Path Tool Max Loger Excel Discussion (Misc queries) 1 March 24th 17 07:59 AM
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
Formula too long - new file path is shorter than old file path - Excel 2003 Greg J Excel Worksheet Functions 1 November 22nd 06 05:16 PM
UNC Path length problem opening a file in excel 2002 or 2003 John Excel Discussion (Misc queries) 3 October 14th 05 03:43 AM
Path\File name length problem Excel Crash on save as Datasort Excel Discussion (Misc queries) 0 April 8th 05 05:19 PM


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