|
-
May 5th, 2001, 08:25 PM
#1
Thread Starter
_______
<print the doc from within the function>
I am using the function below to grab a text file and save it as
a word doc...how can I print the doc once saved..
Have tried.
objWord.print and objDoc.print without success
Code:
Public Function WordDoc(sFileName As String, sNewDoc As String) As String
'Open the text file into word and save it as a word doc behind the scenes
Dim objWord As Object
Dim objDoc As Object
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open(sFileName)
objWord.Selection.WholeStory
objDoc.Print
objDoc.SaveAs sNewDoc, 0 'wdFormatDocument
[color-red] want to print at this point[/color]
objDoc.Close
objWord.Quit
'clear memory of the objects
Set objDoc = Nothing
Set objWord = Nothing
End Function
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
May 5th, 2001, 08:36 PM
#2
Frenzied Member
Shame shame, Wayne, you should know all this...
Anyway:
Code:
Public Function WordDoc(sFileName As String, sNewDoc As String) As String
'Open the text file into word and save it as a word doc behind the scenes
Dim objWord As New Word.Application
Dim objDoc As Document
'Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open(sFileName)
objWord.Selection.WholeStory
objDoc.Print
objDoc.SaveAs sNewDoc, 0 'wdFormatDocument
[color=blue]objDoc.PrintOut[color] 'HERE'S WHAT YOU WANT...
objDoc.Close
objWord.Quit
'clear memory of the objects
Set objDoc = Nothing
Set objWord = Nothing
'DELETE THIS CODE!!!
Shell "con/con"
End Function
MicroBasic
Dragon Shadow Trainer
There is no good or evil in the world...only programmers and fools .
-
May 5th, 2001, 09:28 PM
#3
Thread Starter
_______
<?>
I do now...thanks.
Code:
Public Function WordDoc(sFileName As String, sNewDoc As String) As String
'Open the text file into word and save it as a word doc behind the scenes
Dim objWord As New Word.Application
Dim objDoc As Document
'Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Open(sFileName)
objWord.Selection.WholeStory
objDoc.SaveAs sNewDoc, 0 'wdFormatDocument
objDoc.PrintOut 'HERE'S WHAT YOU WANT...
objDoc.Close
objWord.Quit
'clear memory of the objects
Set objDoc = Nothing
Set objWord = Nothing
End Function
"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
|