|
-
Nov 29th, 2000, 05:19 PM
#1
Thread Starter
New Member
Hello
This is my first post in this forum - welcome to me!! :-)
Ok - I have made a small viewer utility app in VB6 that I want to use at work to view and print the contents of MS WOrd files. I have created an App using filelist boxes that show the filenames - my concept is that when I double click on the filename, it loads itself into SOMETHING! In my code example below, I have created this to work, except I had to save the word file in rtf format and load it into the RTF control (it works) -- I really don't want to do that since I lose Word's formatting. What I have been trying to do is use the MS Word Document "insertable Object" that I can add to my toolbar, but I can't make/understand how to load the file into it - there is no .LoadFile option given to me when I use this object.
I have even experimented with using the Shell command to have the file open into the MS Word viewer (or Word for that matter) but I CAN'T have the form be editable - don't want anyone messin with it, and I don't see a way to block access ..I just want the user to have the ability to see it and print.
Here's my code example - using the RTF that works
Private Sub fileABC_DblClick()
'allows double click on filename to load the file
Dim SelectedFile
SelectedFile = fileABC.Path & "\" & fileABC.FileName
rtfText.LoadFile (SelectedFile)
End Sub
Anyone out there have any other suggestions?
Thanks
PCHMilin
-
Nov 29th, 2000, 09:42 PM
#2
_______
<?>
Code:
Option Explicit
Private Sub Form_Load()
'in references, make reference to word object
File1.Path = "C:\"
File1.Pattern = "*.doc"
End Sub
Private Sub File1_Click()
Dim strInput As String '<<<< variable for macro name
Dim oWord As Object
Set oWord = New Word.Application
oWord.Visible = True '<<<< make word visible (not needed unless you need visible)
oWord.Documents.Open File1.Path & File1.FileName
Close
Set oWord = Nothing
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
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
|