ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Starting another program (again) Maybe TOM (https://www.excelbanter.com/excel-programming/341689-starting-another-program-again-maybe-tom.html)

Alvin Hansen[_2_]

Starting another program (again) Maybe TOM
 
Hi
i start where we ended last
Is there not a way to have a file name longer than 12

Tom Wrote:


Just another thought. After you get lngChars, look at it with msgbox

msgbox lngChars

if it is longer than 12, then that is your problem. If you created the test
file in Notepad, you should type in the 12 characters and then do file save.
No Return at the end of the 12 characters.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
This worked fine for me:

Sub mno()
On Error GoTo E_Handle
Dim strImport As String
Dim lngChars As Long
Dim intFile As Integer
intFile = FreeFile
Open "C:\alm.txt" For Input As intFile
lngChars = LOF(intFile)
strImport = Trim(Input(lngChars, intFile))
Shell ("c:\windows\notepad.exe '" & strImport & "'")
E_Handle:
Close #intFile

End Sub



Tom Ogilvy

Starting another program (again) Maybe TOM
 
12 was specifically the length of "C:\gemme.txt"

the thought was that you might be getting back more than the 12 characters
"C:\gemme.txt". You can have a string a long as you want in the file as
long as it represents a valid fully qualified path.

--
Regards,
Tom Ogilvy

"Alvin Hansen" wrote in message
...
Hi
i start where we ended last
Is there not a way to have a file name longer than 12

Tom Wrote:


Just another thought. After you get lngChars, look at it with msgbox

msgbox lngChars

if it is longer than 12, then that is your problem. If you created the

test
file in Notepad, you should type in the 12 characters and then do file

save.
No Return at the end of the 12 characters.

--
Regards,
Tom Ogilvy

"Tom Ogilvy" wrote in message
...
This worked fine for me:

Sub mno()
On Error GoTo E_Handle
Dim strImport As String
Dim lngChars As Long
Dim intFile As Integer
intFile = FreeFile
Open "C:\alm.txt" For Input As intFile
lngChars = LOF(intFile)
strImport = Trim(Input(lngChars, intFile))
Shell ("c:\windows\notepad.exe '" & strImport & "'")
E_Handle:
Close #intFile

End Sub






All times are GMT +1. The time now is 01:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com