|
-
Oct 6th, 2000, 01:47 PM
#1
Thread Starter
Hyperactive Member
I need to have my program open a txt file and disply it, but it is very very large. so I would like to have the win program word pad open it. :-)
either with in my program or externally is fine, It is just to view a couple thousand line log file.
Please help...
Sincerely,
Nick
-
Oct 6th, 2000, 01:57 PM
#2
Code:
'notepad:
Shell "Notepad.exe C:\txtfile.txt", vbNormalFocus
'wordpad:
Shell "Wordpad.exe C:\txtfile.txt", vbNormalFocus
-
Oct 6th, 2000, 04:49 PM
#3
_______
<?>
You need the path for the application as well as the path for the file to be opened. Use shelldef as it will find the correct application with which to open the file:
Code:
Option Explicit
'put this in a bas module
'
Public Declare Function ShellEx Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As Any, _
ByVal lpDirectory As Any, ByVal nShowCmd As Long) As Long
'
Sub ShellDef(strFileName)
Dim x As Long
x = ShellEx(Form1.hwnd, "open", strFileName, "", "", 1)
End Sub
'put this in your form
'whatever is needed to open your file will open it.
Option Explicit
Private Sub Command1_Click()
Dim strYourFileVariable$
strYourFileVariable = "C:\my documents\readme.txt"
ShellDef strYourFileVariable
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Oct 6th, 2000, 05:05 PM
#4
Monday Morning Lunatic
For speed, send it straight to notepad. If it's small enough, NP will load it quickly, otherwise it will load WordPad for you and display it in that.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Oct 6th, 2000, 05:08 PM
#5
_______
<?>
When you use shelldef, if it has a .txt extension the Notepad will be the guy if it's within the scope of the program to open it.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
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
|