Export To Word
Jun 26, 2006
Boy am I frustrated.
I have searched the forums for similar problem but I was unable to find it.
I have some buttons that export the data from a form into a Word Document. It generally works but there are some issues.
I have Access 2003 but the people using it only use the runtime version of Access and the environment is Office 2000.
I have copied code from other examples and maybe missing something that is causing the issues.
1. When I export the record it is causing problems with the Normal.dot template. When I try to close Word it keeps asking me that I have modified that template. After pressing Cancel button twice it the save box disappears.
2. When I leave the code Dim objWord As word.Application I get an error message about a compile error User defined Type not defined.
2. When the users try to export a record to the specific word template I
created and a required field is empty an error message is displayed and then closes the application.
Any help will be appreciated. I am a newbie when it comes to code.
Sample code is below.
Private Sub Command1079_Click()
Dim objWord As word.Application
'Start Microsoft Word 2000.
Set objWord = CreateObject("Word.Application")
With objWord
'Make the application visible.
.Visible = False
'path and name of the template your are using.
' objWord.Documents.Add ("U:Asset Strategy and Commercial PropertyCommercial PropertyTaskmasterletterofobjection.dot")
.Documents.Open ("C:Documents and SettingsDadMy DocumentsWorkTaskmasterletterofobjection.dot")
'This is for the bookmark that you created in the template
.ActiveDocument.Bookmarks("bmSubject").Select
Selection.Text = Forms![frmTaskMaster_LeaseManagement]![Subject]
.ActiveDocument.Bookmarks("bmCurrentRent").Select
.Selection.Text = Format(CCur(Forms![frmTaskMaster_LeaseManagement]![CurrentRent]), "Currency")
.ActiveDocument.Bookmarks("bmVendetails").Select
.Selection.Text = Forms![frmTaskMaster_LeaseManagement]![VenDetails]
.ActiveDocument.Bookmarks("bmDateNotice").Select
.Selection.Text = Format(CDate(Forms![frmTaskMaster_LeaseManagement]![RentNotice]), "dd mmmm yyyy")
.ActiveDocument.Bookmarks("bmRentReviewDate").Select
.Selection.Text = Format(CDate(Forms![frmTaskMaster_LeaseManagement]![ReviewDate]), "dd mmmm yyyy")
.ActiveDocument.Bookmarks("bmAskingRent").Select
.Selection.Text = Format(CCur(Forms![frmTaskMaster_LeaseManagement]![AskingRent]), "Currency")
End With
Print_Reconsideration_Err:
'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
.Selection.Text = ""
Resume Next
End If
objWord.Application.Options.PrintBackground = False
objWord.Application.ActiveDocument.PrintOut
End Sub
View Replies
ADVERTISEMENT
Nov 17, 2004
I have a template fax set up in Microsoft word and want to be able to export fields from my database (in form view) to the word document. For example, I have a 'purchase order No' on the access form which I want to send to the Word document. When exported I then want the user to be prompted to save the document as a new name so they do not overwrite the original template fax.
Any ideas guys,
Cheers,
Recall.
View 1 Replies
View Related
Mar 20, 2008
I have a table called "MPI_CODE" it has 4 columns. How can I export this to Word? By creating a new document first (Using Save dialog) then exporting that table to the word doc. Mainly looking for the code to export the table into word.
Thanks in advance for your help.
View 2 Replies
View Related
Mar 7, 2006
Hello friends, I have a good question for you.
I have a form in Access with a check box named chk1.
On the same form I have a code that export my data to a template in MS Word. I use bookmark to export my access data. No problem with regular data but cannot handle checkboxes. Basically I need help to export the check box value (yes or no) into a check box places in my word template. In this template I have a checkbox. If I doulble click in to it I get a window which allows me to bookmark the checkbox but when I export the access data, I will get a YES or NO priot to the checkbox in word. Is there any way I can solve this problem?
This is a sample of my code:
objWord.ActiveDocument.Bookmarks("chek1").Select
If Err.Number = 0 Then
objWord.Selection.Text = Me.chek1
Else
Err.Number = 0
End If
Is the probkem in the Selection.text?
Thank you.
View 1 Replies
View Related
Apr 12, 2006
Friend, I am using a code to export data from a table to a word document using bookmarks and have a problem with the SSN format.
When I export the ssn it shows in my word field in this way:
123456789. What I need it that it shows using the following format: 123-45-6789
This is the code:
objWord.ActiveDocument.Bookmarks("SSN").Select
If Err.Number = 0 Then
objWord.Selection.Text = Me.SSN
Else
Err.Number = 0
End If
Any help?
View 5 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
Jan 16, 2006
we run a family business and i do all the quotations.
i have an access database in which i record these quotations and whether or not we got the job or not, and i have to input all the data manually.
i wondered if i could set a word document so that it would automatically export certain areas of the quotation (like the date, who it was to, what work we are quoting for, how much it would cost, etc) into the correct fields in my database.
can it be done??
any replies will be much appreciated.
thanks
View 5 Replies
View Related
Jul 17, 2015
i have a form which displays 2 charts, i am able to export them to word document but i donot know how to paste them one after the other. currently they get printed one over the other.
here is the code :
Code:
Private Sub cmd_Print_Click()
Dim MyChartObj As Object
Dim MyLineObj As Object
Set MyChartObj = [Forms]![MainForm]![Sub_DisplayFm]![Graph_Chart]
Set MyLineObj = [Forms]![MainForm]![Sub_DisplayFm]![Graph_Line]
MyChartObj.SetFocus
DoCmd.RunCommand acCmdCopy
[Code]...
View 1 Replies
View Related
Feb 27, 2014
Is there a way to export a report from Access into Word so that it keeps all its formatting etc. The only option shown is in RTF format.
View 2 Replies
View Related
Oct 10, 2014
I have a database witch includes a continuous form (named frmExport). It could be very useful for me if i can find a way so to export data from access 2007 and then to import them into a word file.
Please note: The access data will be inserted into word table.
View 2 Replies
View Related
Jan 11, 2014
I want to insert access report in a word document, for this, I use this code:
DoCmd.OutputTo acReport, "rptName", acFormatRTF, "C:ReportFileName.rtf"
But, when that output word file is empty, don't have any chart that was in access report.
View 6 Replies
View Related
Aug 3, 2005
I had to delete a database so I exported selected records using export as a text file thinking I would get some sort of delimited text file that I could later use. Instead I got some sort of fixed length file with .............. between records and | between fields.
I'd like to convert this data to a tab delimited file.
How would I do this?
Thanks
View 12 Replies
View Related
Jun 17, 2013
Is there a way to export a query of 14 items to a word report. I have a table of 14 items in that I use as a query but it only exports 1 item to the report.
View 2 Replies
View Related
Dec 17, 2013
I am trying to export an attachment item (Picture .jpg) to a word document. I have been exporting text to a word document successfully with below syntax "
With rst
strLandSalesID = Nz(.Fields("LandSalesID"))
strPhotograph = Nz(.Fields("Attachments"))
However, attachment do not work.
View 3 Replies
View Related
Jul 10, 2014
How do I export report or table to word document with check box so people can check them and send to me back. I can change my records.
For example
Delete ITEM
5540 (Chick box goes here, they can tick)
View 5 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
May 25, 2015
I am working in Access 2013.I'll be performing a series of inspections at a number of intersections for a small community. The data being captured is consistent from site to site and lends itself to a database application, and what I would like to do is the following:Use forms to capture the data.Generate a report to preview the output for a single record. I may ultimately decide to set the report datasource to a query.Attach a macro to a button that exports fields from that record to a template based in MS Word.The first two bullet items I can handle with my limited Access capability. Each file has to be individually reviewed and saved, and each file will ultimately contain an electronic signature.
View 2 Replies
View Related
Apr 10, 2014
Like the title says it:
Is it possible to link/export a query to a existing Word document?
I have several Word documents with text, and i want to place the data of a few query's in those documents in a certain place.
Is this possible true vba or another way?
View 4 Replies
View Related
Aug 4, 2014
Is there a quick way to export ALL VBA code to a text file/word document?
View 5 Replies
View Related
Apr 11, 2013
How to match 4 character word or number or combination by identical 4 characters word or number or combination in one word have 10 or 15 characters.
I have to two separate tables (Table A and Table B). Table A has one column (Tag No) and Table B has about 15 columns with one column name Tag No as below
Table A
Table B
Tag No
Tag No
2009
ZZZ-2030-DC
2010
ZZZ-2010-M9P
[code]....
They're both in MS Access.I am trying to match 2 tables - columns (Tag No) with join query, but not success. I want to match 4 characters in Table-A with 4 similar characters in Table-B (Tag No) cell.What query is suitable to compare two tables.
View 8 Replies
View Related
Aug 14, 2014
My end goal is to populate a pre-existing table in an MS Word document with records from a query. The easiest way I've found (through scouring the internet) is to start with the code below (ran during OnClick() even in Access) to get the table the same size as the recordset:
Code:
Dim wDoc As Word.Document
Dim wTable As Word.Table
Dim wCell As Word.Cell
Set wDoc = appWord.Documents.Add(strDocLoc)
wDoc.Visible = True
[Code] ....
The code will shrink the table down just fine if the table has more rows than the recordset +1 (for header column). My hangup with this is the last line ("Selection.InsertRowsBelow 5") isn't executing; rows are not being added to the table. I get no errors -- it just does nothing. I set it as "Selection.InsertRowsBelow 5" arbitrarily just to see if it would even add rows, and sure enough it's not.
View 9 Replies
View Related
May 10, 2007
Hello,
Does anyone knows how can I export the export/import specifications (which file/directory) and how can I import/export the specifications between different versions of Access. Thanks!
View 3 Replies
View Related
May 18, 2005
Hi,
I am exporting a table to word and I have come across a problem.
My code opens a template, creates a table with the correct number of rows and columns at a certain position, and then adds data to it.
At this point, everything is fine. But, here is where the problem sticks its ugly head out. I am modifying the column widths and every other time I run it, it crashes, saying something about not being able to access the remote server. Run time error 462.
I have checked in the task manager that word is being quit properly each time and tried going to different templates.
The first time I run it, it runs fine. The second time, it crashes on the line where I change the width. Here is the line of code.
mytable.Columns(1).Width = InchesToPoints(1.2)
I have found that if I close the document after it is created and leave word open, it will run fine.
I think I am in the same boat as mrpauly. But his post date is 23rd April 2001…
http://www.access-programmers.co.uk/forums/showthread.php?t=26363
Has anyone else seen or heard anything like this? I’m really confused…
Thanks for any help anyone can give.
View 1 Replies
View Related
Aug 15, 2007
Hello,
I made a database application and i need some help: in the application i use a script that modifies word documents by opening ms word application, but some customers don't want to install ms word. I'm asking if someone knows tto exist some kind of word runtime that i can modify word documents without having word installed. I'm using also vb6.
Thanks!!!!
View 1 Replies
View Related
Jul 11, 2005
and I want to write in some places
I know to open the word
and write in to the word
to write in to word:
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application")
objWord.Visible = False 'True is visible
objWord.Documents.Add ("C:DocumentsTest.dot")
objWord.ActiveDocument.Bookmarks("bmCusDetails").Select
objWord.Selection.Text = Forms![a]![b]
objWord.Visible = True
but how am I write in a special place?
thanks alot, and sorry on my english
View 1 Replies
View Related
Jul 22, 2005
Exporting datasheet to word, how is this possible using vb. Actually, I do have a thread in Form forum. But, I think not a lot of people visit that place. Anyways, I have created bookmarked and used datavariable to export the data (by ansentry's help). But the only thing that it exports is just one selection on that datasheet, instead of all the chosen rows.
I am exhausted now after searching everywhere, and not finding a clue. How to resolve that situation. If there is an example that I can use, that would be gr8.
Thanks In Adv.
View 2 Replies
View Related