Problems with NT long file names

jeffery_p_sande
06-25-2003, 09:27 AM
I have a visual basic 6 program that uses the standard controls drivelistbox, dirlistbox, and filelistbox to get file names. It works fine with windows 2000. It crashes on Windows NT. The VB6 runtime files are installed on both machines. Has anyone experienced this problem? Solutions?

Thanks in advance.

Jeff Sanders

jeffery_p_sande
06-25-2003, 09:28 AM
The error occurs when selecting a file name with more than eight characters. The windows NT version is NT4.

OnErr0r
06-25-2003, 09:31 AM
After selecting the file, are you passing it elsewhere or trying to do something with it? GetShortPathName API might be helpful.

jeffery_p_sande
06-25-2003, 09:36 AM
I am passing the filename to the GetObject function like this:

Private Sub Command1_Click()

'Get the selected file name
For x = 0 To File1.ListCount - 1
If File1.Selected(x) Then

'add the file name to main form
Main.Text1 = File1.Path + "\" + File1.List(x)

End If
Next x

'Define some objects
Dim myApp As Object
Dim CreateExcelInstance As Object
Dim myShts As Excel.Sheets

'Get an Excel Application Object
Set myApp = GetObject(Main.Text1.Text)

'If error exit the subroutine
If Err Then
MsgBox "Could not create Excel Application object!", vbCritical
CreateExcelInstance = False
Exit Sub
End If

jeffery_p_sande
06-25-2003, 10:10 AM
I just got am email from the user with the problem:

Start of email:

Jeff,

I did some more checking about the long filenames. What I found out was that if the filename is located on the C:drive then the length is no
problem. If I put it back on our LAN with the path of J:\D38SHR\SSPD_AUTOCAD2000\USER\E43168\HIGHLANDTOWN\(FILENAME).XLS then
the program stops and gives me an error right after I select the filename
(.xls). Also the total length is exactly 8 characters before the extension.
Within your VB window were the filenames are shown you will see only 8
characters plus the extension. If the filename is longer than 8
characters then the name is truncated back to 8 characters.

Hope this gives you some info on what might be the problem.

Later.

End of email

This suggest that it is a network problem. Doesn't it?

I've asked the user for his network platform and version.

Jeff Sanders

blindwig
06-26-2003, 08:52 PM
I just got am email from the user with the problem:

Start of email:

Jeff,

I did some more checking about the long filenames. What I found out was that if the filename is located on the C:drive then the length is no
problem. If I put it back on our LAN with the path of J:\D38SHR\SSPD_AUTOCAD2000\USER\E43168\HIGHLANDTOWN\(FILENAME).XLS then
the program stops and gives me an error right after I select the filename
(.xls). Also the total length is exactly 8 characters before the extension.
Within your VB window were the filenames are shown you will see only 8
characters plus the extension. If the filename is longer than 8
characters then the name is truncated back to 8 characters.

Hope this gives you some info on what might be the problem.

Later.

End of email

This suggest that it is a network problem. Doesn't it?

I've asked the user for his network platform and version.

Jeff Sanders
First figure out if the problem is your app or his network. Can he open Excel and save a file that has more than 8 letters?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum