|
-
Aug 5th, 2005, 08:32 AM
#1
[RESOLVED] Word SaveAs And Display On Screen
I have a word document that I created that will be used as a template in one of the apps I'm working one. The user fills out stuff on a VB screen, and the, in turn, get dumped to Bookmarked locations on my template. All of the works. What I can't seem to get working is the SaveAs and having it display on screen prior to being printed. Here is what I have:
VB Code:
Private Sub cmdPrint_Click()
Dim ObjWord As Word.Application
Dim strFileName As String
Set ObjWord = CreateObject("Word.Application")
strFileName = Format(Now, "mmddyyyy HHMMSS")
With ObjWord
.Documents.Open (App.Path & "\TelephoneLog.doc")
.ActiveDocument.Bookmarks("prov_info").Select
.Selection.Text = (cboProvider.List(cboProvider.ListIndex))
.ActiveDocument.Bookmarks("fye").Select
.Selection.Text = (cboFYE.List(cboFYE.ListIndex))
.ActiveDocument.Bookmarks("type").Select
If optMeeting.Value = True Then
.Selection.Text = ("Meeting")
Else
.Selection.Text = ("Telephone Conversation")
End If
.ActiveDocument.Bookmarks("type").Select
.Selection.Text = (txtSubject.Text)
.ActiveDocument.Bookmarks("people").Select
.Selection.Text = (txtPersons.Text)
.ActiveDocument.Bookmarks("action").Select
.Selection.Text = (rtbAction.Text)
.ActiveDocument.Bookmarks("From").Select
.Selection.Text = (gstrUserRealName)
If chkShowDoc.Value = vbChecked Then
.Visible = True
Else
.Visible = False
End If
.ActiveDocument.PrintOut Background:=True
.ActiveDocument.SaveAs FileName:=strFileName & ".doc"
.Application.Documents.Close
End With
Set ObjWord = Nothing
End Sub
I need to have the document saved as DateTime.doc (i.e., 08052005 092820.doc), and I need to set it up so that user can either display it on the screen prior to printing, or never see it and send it directly to the printer.
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
|