Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Open a TXT, DOC file from a command button

0 views
Skip to first unread message

newsguy

unread,
Dec 4, 1998, 3:00:00 AM12/4/98
to
I'm new to VB and am trying to make a CD-ROM Resume application. The form
will have several buttons on it. One button that the user can click on
should open a .txt or .doc file on the CD for viewing onscreen.

I've made the form and the command buttons, but can't figure out the code to
make this event happen.

Can anyone help?

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Guyle M. Taber
Web: www.gmtech.net
Email: gu...@gmtech.net

Cliff

unread,
Dec 5, 1998, 3:00:00 AM12/5/98
to newsguy
"Insure (if you are using a text box to put the file contents into)
you set the "MULTILINE" property to true and the MAXLENGTH property
to a high number (5000)

________________________________________________________________
Option Explicit

Private Sub Command1_Click()
Dim hFile As Integer ' File Handle
' Get the next available file handle
hFile = FreeFile
Dim strBuffer As String 'dimension a string for the file input
' Open the file
Open "YourCDtxt_docfile.txt" For Input As #hFile
'Read the file into the text box
Text1.Text = Input(LOF(hFile), hFile)
' close the file
Close hFile
End Sub
__________________________________________________________________

Hope this helps,
Cliff

--
****************************************
ICQ - 16957341
****************************************
If I had to live my life again, I'd make
the same mistakes again--ONLY SOONER!!!!
****************************************
Last night I dreamt I ate a 10 pound
marshmallow, when I woke up my pillow
was gone.
****************************************

ezan...@insurdata.com

unread,
Dec 8, 1998, 3:00:00 AM12/8/98
to
Try "winword xxxx.doc" in your shell() statement, where xxxx.doc is the full
path of the word document file name.

e.z.


In article <749iap$9...@enews2.newsguy.com>,


"newsguy" <gu...@gmtech.net> wrote:
> I'm new to VB and am trying to make a CD-ROM Resume application. The form
> will have several buttons on it. One button that the user can click on
> should open a .txt or .doc file on the CD for viewing onscreen.
>
> I've made the form and the command buttons, but can't figure out the code to
> make this event happen.
>
> Can anyone help?
>
> --
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Guyle M. Taber
> Web: www.gmtech.net
> Email: gu...@gmtech.net
>
>

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own

WrymEnigma

unread,
Dec 8, 1998, 3:00:00 AM12/8/98
to
On Tue, 08 Dec 1998 16:35:18 GMT, ezan...@insurdata.com said:

>Try "winword xxxx.doc" in your shell() statement, where xxxx.doc is the full
>path of the word document file name.
>
>e.z.
>

You could also just embed the text document, and the word document
into the form the OLE Control in VB6 (could be in eariler versions,
but 6 is all I used), and choosing to Create from File. If you prefer
for the Word and Text Icons not to be displayed, you could make both
of these invisable, and invoke the even from your command buttons.

Just a sugestion that seems better then looking up the WinWord path
location etc.. in the regerstry to insure that it will work properly.

-
Wrym "I might of just answered my first VB question.. WHOO" Enigma

0 new messages