Open "Print Layout" In Word By Code

Jul 16, 2005

In the menu in word there is some option to view the documents
1. Normal
2. Print Layout
3….


I open the word’s document from the access
I insert value from the access into word.

I asked here some question in last week and I helped so much.

My question now is:

In the document in the word I put some bookmarks.
One of the bookmarks is on the header (Title of the document)

And then when I open the document its open in a “Normal” view
I want to open the document in “Print Layout”

Can I open a document in “Print Layout” by code?

The problem code is:
objWord.ActiveDocument.Bookmarks("nivchan").Select
objWord.Selection.Text = Me.M_NIVHAN
Because the Bookmark: “nivchan” is on the header.

Thanks a lot and good week!

View Replies


ADVERTISEMENT

Reports :: Display Report In Popup Window And Maximize In Print Preview Layout

Dec 22, 2013

I have created a report with a subreport for my database. The user selects the project for which he/she wants to see a report. Once the project is selected, the report is displayed in a popup window and maximized in the print preview layout. This allows the user to view and read the report. Once this is done, there are no buttons or menus on the screen that allows the user to send the report to a printer or file.

Other than the report, there are minimize / maximize and close buttons at the top right of the window and page selection buttons at the bottom left of the window. If the user wants to print the report, they must either hit ctrl-P or right click the mouse on the screen to display a menu from which the user can select print to open a print dialog box. Is there any way to add a button or menu to the print preview that appears on the screen to make printing easier?

View 4 Replies View Related

Word Merge Print Options

Feb 9, 2006

I have the below code behind a button to merge and print into MSWord and it's working wonderfully. However, how can I modify it to print 1 copy of page one, TWO copies of page 2 and one copy of page 3?

_________________________________________
Private Sub Print_Reconsideration_Click()
Dim objWord As Word.Application
'Start Microsoft Word 2000.
Set objWord = CreateObject("Word.Application")

With objWord
'Make the application visible.
.Visible = False

'Open the document.
.Documents.Open ("G:PharmacyPrior Auth Docs and DataRevised Pharmacy Denial Processes
econsideration.doc")

'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("bmkFirstName").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRFirst))

.ActiveDocument.Bookmarks("bmkLastName").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRLast))

.ActiveDocument.Bookmarks("bmkHRN").Select
.Selection.Text = (CStr(Forms!frmDenial!MemberNumber))

.ActiveDocument.Bookmarks("bmkAddress1").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRAddress1))

.ActiveDocument.Bookmarks("bmkCity").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRCity))

.ActiveDocument.Bookmarks("bmkState").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRState))

.ActiveDocument.Bookmarks("bmkZip").Select
.Selection.Text = (CStr(Forms!frmDenial!ZipCode))

.ActiveDocument.Bookmarks("bmkDrug").Select
.Selection.Text = (CStr(Forms!frmDenial!DrugName2))

.ActiveDocument.Bookmarks("bmkStrength").Select
.Selection.Text = (CStr(Forms!frmDenial!Strength))

.ActiveDocument.Bookmarks("bmkDate").Select
.Selection.Text = (CStr(Forms!frmDenial!DateReceivedbyPlan))

.ActiveDocument.Bookmarks("bmkDate2").Select
.Selection.Text = (CStr(Forms!frmDenial!DateReceivedbyPlan))

.ActiveDocument.Bookmarks("bmkMDFirst").Select
.Selection.Text = (CStr(Forms!frmDenial!MDNameFirst))

.ActiveDocument.Bookmarks("bmkMDLast").Select
.Selection.Text = (CStr(Forms!frmDenial!MDLastName2))

.ActiveDocument.Bookmarks("bmkMDCred").Select
.Selection.Text = (CStr(Forms!frmDenial!Credential))

.ActiveDocument.Bookmarks("bmkFirstName2").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRFirst))

.ActiveDocument.Bookmarks("bmkLastName2").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRLast))

.ActiveDocument.Bookmarks("bmkMDFirst2").Select
.Selection.Text = (CStr(Forms!frmDenial!MDNameFirst))

.ActiveDocument.Bookmarks("bmkMDLast2").Select
.Selection.Text = (CStr(Forms!frmDenial!MDLastName2))

.ActiveDocument.Bookmarks("bmkMDCred2").Select
.Selection.Text = (CStr(Forms!frmDenial!Credential))

.ActiveDocument.Bookmarks("bmkFirstName3").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRFirst))

.ActiveDocument.Bookmarks("bmkLastName3").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRLast))

.ActiveDocument.Bookmarks("bmkAddress11").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRAddress1))

.ActiveDocument.Bookmarks("bmkCity2").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRCity))

.ActiveDocument.Bookmarks("bmkState2").Select
.Selection.Text = (CStr(Forms!frmDenial!MBRState))

.ActiveDocument.Bookmarks("bmkZip2").Select
.Selection.Text = (CStr(Forms!frmDenial!ZipCode))

.ActiveDocument.Bookmarks("bmkMDAddress1").Select
.Selection.Text = (CStr(Forms!frmDenial!MDAddress1))

.ActiveDocument.Bookmarks("bmkMDCity").Select
.Selection.Text = (CStr(Forms!frmDenial!MDCity))

.ActiveDocument.Bookmarks("bmkMDState").Select
.Selection.Text = (CStr(Forms!frmDenial!MDState))

.ActiveDocument.Bookmarks("bmkMDZip").Select
.Selection.Text = (CStr(Forms!frmDenial!MDZip))
End With

Print_Reconsideration_Err:
'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next

End If
objWord.Application.Options.PrintBackground = False
objWord.Application.ActiveDocument.PrintOut
ActiveDocument.Close wdDoNotSaveChanges
End Sub

View 2 Replies View Related

How To Print A Word Document After Running RunApp??

Feb 2, 2006

Hi
I want to open a Word Document in access, so I am using the Runapp macro. It says to enter a command line. So, i input the path of the document and run the macro. It works great! But now I need to get the Word document to print after it is opened.
I wasn't sure how to do this. I have tried to create a macro in Word to automatically print the document but that didn't work. Then I used the RunCommand under macros in Access and selected PrintOut. I received an error message and I also tried the sendkeys. Nothing has worked.
Anyone have any ideas on how to do this? Any help would be great!
Thanks

View 3 Replies View Related

Reports :: Subreport To Print Word None If Blank

Jun 4, 2014

I have a report with four subreports. If the subreports have no data I have a formula to put the word 'none' in the first field as follows:

=IIf(IsNull([Question]),"None",[Question])

I do a print preview and the word 'None' shows up and subreport looks good when I view just the subreport as well as when I view the full report.

When I print the subreport the text '#Error' prints. When I print the full report I just get a blank space.

I need the subreport to print with the word 'None' if there is not data. How do I accomplish? I tried the above formula both in the query and in the control source of the report. It just comes up blank when I put it in the query.

View 3 Replies View Related

Modules & VBA :: Displaying Word Print Dialogue Box

May 10, 2015

Code for displaying the Word Print dialogue box instead of sending it straight to the printer.

I have the following code:

'Open Word
Set objWord = New Word.Application
'Letter document would be open
Set objletter = objWord.Documents.Open(strletterpath & strworddoc)
objletter.MailMerge.OpenDataSource (strletterpath & strletterfile)
objletter.MailMerge.Destination = wdSendToPrinter 'normally print
Dialogs(wdDialogFilePrint).Show
objletter.MailMerge.Execute
'not normally here
'objWord.Visible = True

This is to produce a mailmerge based upon a query.

Previously on Access 2000 and Word 2000 it would display the print dialogue box, but I am trying to upgrade it all to 2013 and this does not do it now with Access 2013 and Word 2013.

View 3 Replies View Related

Forms :: Export Single Record To Word To Print

Apr 14, 2013

I would like to have a button (cmdPrintIntroLetter) on my Client Details form that takes the client name, address and company data of the record that I'm currently viewing and putting it into an address box in a Word document.

e.g. when I contact a new customer and input their details into my form I want to then be able to send them an introductory letter (standard wording) from me with just the click of a button.

FAO: FirstName LastName
CompanyName
Address1
Address2
Address3
Town
County
Postcode

I've been faffing around with concatenating my address fields into an address textbox in a report but I really don't like using a report to write a letter, it just feels wrong - on every level.I also want another button (cmdEmailBrochure) which opens an email template using the records email address and inserting the name of the client into the body of the email.

View 1 Replies View Related

Print VBA Code

Apr 5, 2007

I need to print out my VBA code , I was wondering if there is an easier way to do it without cutting and pasting it onto Microsoft word.

View 1 Replies View Related

Code To Print!

Aug 24, 2007

Hello,

What's is the exact syntax to print a subformB (within a formA) using VBA code?
The code will be on the OnClick event of a button and the button is on formA.

Thanks

View 1 Replies View Related

Multiple Word Search In Code

Apr 17, 2008

Hi everyone. I have the following code attached to a text box.

Private Sub txtsearch_AfterUpdate()
Me.lstsearch.RowSource = "Select [R&D ID#], [SKU#], [Project Name], [Construction level], [Manufacturer], [Hobbico Status], [R&D Work By], [Product Manager], [Desktopper]" & _
"From [Project Main]" & _
"Where [Project Name] like '*" & Me.txtsearch & "*'" & _
"OR [SKU#] like '*" & Me.txtsearch & "*'" & _
"OR [R&D Work By] like '*" & Me.txtsearch & "*'" & _
"OR [Product Manager] like '*" & Me.txtsearch & "*'" & _
"OR [Desktopper] like '*" & Me.txtsearch & "*'" & _
"OR [R&D ID#] like '*" & Me.txtsearch & "*'"
Me.lstsearch.Requery
End Sub

This code searched for matching text strings in a few different filed. It is working really well, but it would become much more helpful if instead of searching one single text string, I could enter two in the same box and it would perform the search based on matching both strings, that is, list all the records that have xxxx and xxxx in any of the fields checked.

Can the above code be tweaked to do this?

mafhobb

View 2 Replies View Related

General :: How To Print Complete Code Of A Project

Jul 9, 2013

How do I print the complete code of a project? If I select all the code with CTRL+A in the code window does it print all the objects of the project I'm in or I have to select each object from the drop down list at the top of the code window?

View 6 Replies View Related

TRying To Open A Word Doc From Access

Sep 20, 2004

I have a word doc which i can open from Access but i need advice on something i would like to try out.

I have a form with a patients name and i can scroll through the table through here(on the form using nav buttons) as well and see other patients information. What i'm trying to do is according to whoever is on the form when they click on the button to open the word doc i want the patients name to appear on the word doc.

I guess it's like a Mail merge but i want the data to be pulled from the form like the patients name and address and i want this information to go onto the Word Doc. Any ideas on how to do this.

Access 2003 and Word 2003.

Thanks in advance,
Skiball

View 4 Replies View Related

Queries :: Return Word Unknown For Any Code That Doesn't Have A Match

Aug 20, 2013

I have lookup table I use to return names for various "Sales Class" codes.It all works good but if there is a code that isn't in the lookup table it leaves that field empty.I want it to return the word "Unknown" for any code that doesn't have a match.Here is the SQL:

Code:

SELECT [Data1].OrderNum, SalesClasses.[Name]
FROM [Data1]
LEFT JOIN SalesClasses ON [Data1].[Sales Class] = SalesClasses.[Code1];

Table examples:

Data1:
OrderNum - Sales Class
111 - class1
222 - class2
333 - classX

[code]...

View 3 Replies View Related

Open A Word File From A Form

Jun 5, 2005

Hi all
I need to run a certain file from the form
I create a button as follows
Select in the categories "Applications" then select "Run Ms Word"
I have tested it and it open Word but not even a blank page
I then open the code as seen below and want to insert the filename but do not know where. Can someone please help me?

Private Sub Command35_Click()
On Error GoTo Err_Command35_Click

Dim oApp As Object

Set oApp = CreateObject("Word.Application")
oApp.Visible = True

Exit_Command35_Click:
Exit Sub

Err_Command35_Click:
MsgBox Err.Description
Resume Exit_Command35_Click

End Sub

The file is - D:PanelbeatersPb Manual.doc

View 2 Replies View Related

How To Open A Word Document From Within Access

Jan 4, 2007

I am creating a database for someone which includes a mail merged document with some data from the database.
Is it possible to allow the user to open the document by clicking on a button that will be on the Switchboard in the database, so that they do not have manually open the document?
Hope this makes sense!

View 5 Replies View Related

Open Word Specific Page

Apr 5, 2008

Anyone able to help. Can a command button be coded to open either a Word or PDF file at a specific page number? Any help really appreciated.

View 1 Replies View Related

Open A Word File Within Access

Jan 11, 2007

I would like to Open a Word file throught Access code.
With the following code I can start Word, but how can I specify the file name I want to Open:

Dim wrdApp As Object
Set wrdApp = CreateObject("Word.application")
wrdApp.Visible = True

Thanks

View 2 Replies View Related

Modules & VBA :: Quick Way To Export ALL VBA Code To A Text File / Word Document?

Aug 4, 2014

Is there a quick way to export ALL VBA code to a text file/word document?

View 5 Replies View Related

Open Word Window On Access Form

Sep 6, 2005

Hello,
I am a researcher creating critical editions of ancient texts by collating readings from several manuscripts (i.e. different mss all contain minor differences). I create my edition in Word and use footnotes to record the variant readings. I also have a database - created from the word file - in which I can add context to each variant e.g. decisions, history etc. So I have a word file containing the text and its variants uniquely identified with a footnote reference and a database with one table and a record per variant and where the variant records are also unique and share the same number as the footnote. I would very much like to be able to open a window on my variant form which displays the word file at the correct variant (i.e. footnote reference) location. This will make it easier for me to record my assessments of the variant in the dbase while looking at where the variant occurs in the text. Obviously I don't need to see the footnote window as I have this info in the dbase.
I haven't got a clue how to do this and would appreciate any pointers.
Many thanks in advance,
Tim

View 1 Replies View Related

Open Hyperlinked Word Documents As Read Only

Mar 22, 2014

I have a database with hyperlinks to open word documents on my network. If someone else has that word document open it will ask me if I want to notify or open in read only. However since upgrading to Access 2013, (from Access 2003), this sometimes freezes the database.

I am wandering is there a way to tell Access (or Word) to open the document in read only if there is someone using it already?

View 1 Replies View Related

Open Word File Off Access Form

Jul 9, 2012

I have fairly large Access 2003 tables and forms on my job. I am curious if I can open word document off the form by using command button. Very often I need to put info off the form to word and sent it via e-mail to clients so I every time I have to keep a lot open word documents at the same time on my computer 10 or more that is slow pc down. I would like to have like this : on specific form I have command button and when i need to work with word document , click that button that will open specific word doc and when I am done I think I need a second command button to safe and close word document and so that i can attach it to e-mail and sent it out. So every time I need to work with word doc, I can open it off the form and close it also when I am done with it so no word doc would be open unnecessarily.

View 8 Replies View Related

Using A Form Button To Open And Insert Data Into A Word Doc

May 12, 2006

Hi all,
Not sure if this is in the right section but heres my question.

How can i gett a button to open a word document and put in specific information. for example. to send a client a letter, the button would open a word doc with the specfic client data in it.

Also a button to start a mail merge with all client records held on the db.

Thanks for any help

View 2 Replies View Related

Use Access To Open Word, Create A NEW Document, And Then Edit The Doc

Dec 11, 2004

I want to create a new word doc, do a saveas to a specific path and file name, allow the user to edit the new doc, and then close it and return to the Access app. I can create the doc but Word opens without opening the New Savedas Doc. using this code

Dim oApp As Word.Application
Dim WordDoc As Word.Document
Set oApp = CreateObject("Word.Application")
Set WordDoc = CreateObject("Word.document")
oApp.Visible = True
WordDoc.SaveAs ("TS-" & Me.Scriptnum & ".Doc")

Your help is appreciated.

View 1 Replies View Related

User Database From Command To Open Word Document

Mar 6, 2007

In access database, Is there anyone know how use macro to open a word document on a share drive..(example S:safetyRegulation.doc)?.

Here is what I did and it doesn't work.. Runapp command line: C:Program FilesMicrosoftOfficeOfficeWINWORD.EXE //S:safetyRegulation.doc.
Is there any easier way to do this? Please advice..thanks Rob..

View 1 Replies View Related

Modules & VBA :: Search To Open Word Document From Access

Oct 27, 2014

I was tasked to create an application where by the user enters keywords into an Access form, and when he clicks the button, it will run the keywords against the file names stored in the table and automatically open the Word document that is the best match.

I have created a table query called Directory, which contains FPath (Z:), FName (Document1.doc) and Directory (Z:Document1.doc).

Code:
Private Sub Command2_Click()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim filepath As String
Dim strSearch As String

If IsNull(Me.txtSearch) Or Me.txtSearch = "" Then
MsgBox "Please type in your search keyword.", vbOKOnly, "Keyword Needed"

[Code] ....

This is the code that I am currently using to search and open the Word documents, however, this code only manages to open Microsoft Word program without loading any documents. Also, there are no error messages when I click the submit button.

View 3 Replies View Related

Reports :: Open Report As A Microsoft Word File

Jun 26, 2014

I want to open a simple report (restricted to the current record) but I need it as a editable MS Word file, (not printed or pdf, etc.)

Quote:

Private Sub MyReport_Click()
Dim stDocName As String
Dim strWhere As String

[code]....

I've tried several combinations of vba..I'm using Microsoft Access 2007

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved