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 Replies
ADVERTISEMENT
Sep 14, 2005
Hello,
Is it possible to get Access to open the print dialogue box instead of printing direct to the default printer when using the print command?
Thanks
View 1 Replies
View Related
Sep 14, 2005
Hello,
Is it possible to get Access to open the print dialogue box instead of printing direct to the default printer when using the print command from a button?
Thanks
View 3 Replies
View Related
Jul 8, 2015
On this form, there is a text box for Quantity...At the end of the form, there will be a button that when pressed:The current record the data on the form is entered for is saved,A report is printed on a specific printer,I do not want the report to actual display,The number of copies it prints should be equal to what the quantity field indicates.I do have the report already created and the Quantity field is on the report (just not visible).Once this all happens, it should return the user to the form, that is blank, waiting for a new record entry.
View 1 Replies
View Related
Sep 12, 2006
Here is my relationships and a copy of my SQL for this query. Why is it displaying the PK number (RaceClass) instead of the word.
My table for RaceClass has the number, the query has the number but my form has the word.
Many thanks for any help.
Tee.
View 1 Replies
View Related
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
Dec 17, 2014
I was trying to filter a word using Not Like "word" in my query cirteria, some data is blank also, From this record i want to retrieve the result. But when i use Not Like Criteria, filter is working but blanks columns are also filtered.
I want to display all records (including blanks) except what i shown in the criteria.
View 2 Replies
View Related
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
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
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
Sep 23, 2005
I recently made a search form using the Like ""*" & [Forms]![search]![Text0] & "*" Or Is Null" in the Criteria. Now when I open the querie it opens a dialoge box that say's "enter paramiter value" then it has a little text box to put in the values for the criteria. but I don't want these boxes to come up how can I get rid of these?
View 6 Replies
View Related
Nov 10, 2006
Can anyone help me out I am trying to create a command button (cmdBrowse) that pops open a file dialogue to select a file.
I am not sure how to do this, does anyone know?
If you need more of an explaination. I am trying to create a form for a user to be able to select the document needed to be imported into the database.
View 3 Replies
View Related
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 5 Replies
View Related
Jan 31, 2006
hi all
i want to export a data base to a flash stick.
Rather than export the database to a predetermined drive letter (because all computers are configured differently), I'd like the windows "my computer dialogue" window to appear so that the user can choose which drive to save to.
Any idea how I can do this?
Thanks
View 14 Replies
View Related
Sep 20, 2012
I want to open the 'Save Backup As' Dialogue Box from the file menu, using a Command Button on a Form in Access 2003.I know you can do this manually but I would love to do it programically.
View 4 Replies
View Related
Jul 8, 2014
I want to display a picture (or pictures) from Imagelist in the picturebox (KIBES_picture).But I am getting a type mismatch error in the last line. What am I doing wrong?
Code:
Public Sub load_picture()
Dim iml As ImageList
Set iml = New ImageList
iml.ListImages.Add , , LoadPicture("K:Kapa-Planung ElektrikKibes_DatabaseAufbausystemme2_Innenbeleuchtung .00000-0002_Treppebeleuchtung_ueber_2 Schalters_087A00ekran_edycja.jpg")
[Forms]![Search]![KIBES_picture].Picture = iml.ListImages(1)
Besides, when I have Listimage(0) I am getting an other error: Index out of bounds. Strange, because the index should start from zero?
View 1 Replies
View Related
Sep 22, 2013
I have created some tables using CREATE TABLE but they do not appear in the list of tables although they are there. How to make them appear.
View 1 Replies
View Related
Feb 27, 2015
I'm creating a folder with values from some fields. It all goes OK, but, the only thing is that the name of the folder could get to long.
We use words like "Prototype Model" "Prototype Review" Next Date Review" "Next Prototype Review"
How could I end up with only the first letter from each word like "PM" "PR" "NDR" "NPR" from a field called Type_Review ?
View 14 Replies
View Related
Mar 14, 2014
I'm using the below to merge from acces to word and create a new doc. All is well.However I need to save the output file type as PDF.When I try to change the docx to PDF, it corrupts?
Dim wordApp1 As Word.Application
Dim docPath1 As String
Dim fileName1 As String
docPath1 = Application.CurrentProject.Path & "Merges"
fileName1 = docPath1 & "CreatedCover Letter.docx"
Set wordApp1 = New Word.Application
With wordApp1
[code]...
View 1 Replies
View Related
Oct 7, 2014
I have a database with several one-to-many relationships and a nested subform based off of those relationships. Relationships are as follows:
One Lender to Many Relationship IDs
One Relationship ID to Many Tax IDs
One Tax ID to Many DocumentsRequired
My forms are nested as follows:
Relationship ID form (contains info for Relationship ID and Lender)
-> Tax ID
-> DocumentsRequired
I believe I'm just overcomplicating this. But I have simple search box (an unbound text box with a command button), which is located on the top-level form for Relationship IDs. As you'll see above, that form only contains the fields for Relationship ID and Lender. However, users have to be able to search by Relationship ID, Customer Name, or Tax ID number, the last two of which are only available on the nested subforms. Currently I have the search box reaching out to grab results from a query. When I assign the results to the Me.RecordSource, it works perfectly except that it's in read-only format. The users have to be able to edit the results of their search. I'm not even sure I'm doing this in the easiest fashion. I would have preferred to just use the select statement to search through the subform, but I'm guessing my syntax was wrong because I never got it to work. Below is what I currently have.
Dim strtext As String
Dim strsearch As String
strtext = Me.SearchBoxTxt.Value
strsearch = "SELECT [Relationship ID] " & _
"FROM CustomerNormQuery " & _
"WHERE [Relationship ID] like ""*" & strtext & "*"" OR [Customer Name] Like ""*" & strtext & "*"" " & _
"OR [EIN/SSN] Like ""*" & strtext & "*"" " & _
"GROUP BY [Relationship ID]"
Me.RecordSource = strsearch
View 4 Replies
View Related
Sep 24, 2013
Debugging my VBA code. I'm trying to track/display the content/value of a couple of variables to make sure they have the right value at a certain point.
What is the VBA code to say "display content of variable Var1" ? Where exactly will it display the value when instruction is executed?
I know I can just hover the mouse on a variable to see its content but some string varables like SELECT commands are too long and you cannot see the whole string.
View 2 Replies
View Related
Sep 26, 2013
I'm trying to create an export to word but am having some trouble. I keep getting the following error;
Run time error '91'; variable or object of With block not defined.
This error occurs at Set TblWord = docNew.Tables.Add(Selection.Range, 3, 5)
I have a feeling its 'Selection' that is causing the problem but I can't work it out!
Code:
Dim AppWord As Word.Application
Dim DocWord As Word.Document
Dim TblWord As Word.Table
[Code]......
View 4 Replies
View Related
Sep 30, 2013
I have below vba code in a sub that opens word application and generates the data from a table based on criteria provided thru a form.
These lines are smoothly working..
But I need to place some headings in first line or second line of the document and then to start the table information to appear in the doc.
I tried to place my company name below way (see bold lines);
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim I As Integer
Set db = CurrentDb()
Set rs = db.OpenRecordset("SELECT * FROM T_CustomerMaster WHERE SALESMANCODE='" & Forms!F_ReportMaster!TxtRepCode & "' order by custcode;")
WordSetup
doc.Tables.Add Range:=doc.Range, numrows:=1, numcolumns:=5
'Trying to place main heading
'doc.Range(1, 0).Text = "fsdafds"
[Code] ....
But the table starting from column 1 and cell 1 till data ends up.
Finally I converted my trial lines to remark as it is not working at all.
View 8 Replies
View Related
Aug 19, 2014
For Example:
Cell.Interior.Color = "vb"&Cell.Offset(0,1).value
The value is a text "Green"..The expected keyword is vbGreen. Possible?
View 3 Replies
View Related
Oct 24, 2013
I never used watermarks before so looking for access
[COLOR=blue !important][COLOR=blue !important]vba[/COLOR][/COLOR] c
Code that add a watermark on a
[COLOR=blue !important][COLOR=blue !important]word [COLOR=blue !important]document[/COLOR][/COLOR][/COLOR].
View 14 Replies
View Related
Sep 30, 2013
I am saving my word doc thru below vba code
.......
..........
doc.SaveAs ("Customers.doc")
..........
.......
Which is saving here :
C:UsersashfaqueDocuments
I need to save it to desktop or somewhere I want.
How can I specifically mention the path in my vba code to save this document at the desired place?
View 3 Replies
View Related