|
-
Nov 22nd, 2002, 03:34 PM
#1
Thread Starter
Banned
text
How does one open a text file?
-
Nov 22nd, 2002, 03:36 PM
#2
Hyperactive Member
Open "TESTFILE" For Input As #1
' Close before reopening in another mode.
Close #1
-
Nov 22nd, 2002, 03:40 PM
#3
Thread Starter
Banned
I meant I want to open and see this file...
view it.
-
Nov 22nd, 2002, 03:46 PM
#4
Hyperactive Member
VB Code:
Shell "notepad C:\MyFile.txt"
I think this is the bunkiest way to do it...
And I, for one, welcome our new insect overlords. I'd like to remind them as a trusted TV personality, I can be helpful in rounding up others to toil in their underground sugar caves.
-
Nov 22nd, 2002, 03:51 PM
#5
Thread Starter
Banned
can i do the following:
Code:
On Error GoTo Handle_It
Dim path As String
path = "notepad \\Predator\SOMT\SAPFiles\SOMT_" & Format(Now, "dd-mmm-yy") & ".txt"
Shell path
Done:
Exit Sub
Handle_It:
MsgBox Err.Description, vbCritical, "Error #: " & Err.Number
Resume Done
-
Nov 22nd, 2002, 03:53 PM
#6
Thread Starter
Banned
-
Nov 22nd, 2002, 03:56 PM
#7
Lively Member
Code:
file1$ = "C:\test.txt"
Open file1$ For Input As #1
While Not EOF(1)
Input #1, Doit$
DoEvents
List1.AddItem Doit$
Wend
Close #1
-
Nov 22nd, 2002, 04:50 PM
#8
You don't have to lock youself into NotePad. The following code will use whatever tool (Word, WordPad, etc.) is set up to be the default reader for a textfile.
VB Code:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
ShellExecute Me.hwnd, "open", "c:\marty.txt", _
vbNullString, "C:\", _
1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|