Modules & VBA :: How To Update Data For A Chart Graph In Word Document From Access
Jul 29, 2013Is it possible to update the data for a chart graph in a word document from Access using VBA?
View RepliesIs it possible to update the data for a chart graph in a word document from Access using VBA?
View RepliesNot sure if this is possible but I am trying to extract data from a word document to set up a database.
Basically I am trying to capture data from completed forms, similar to the sample attached, the actual blank form is 20 pages long and once completed can be as many as 30 pages, or even more, although the format doesnt change (i.e. individidual cells will expand to fit the data in the cell).
I want to be able to scan through the completed forms and extract the data i.e. Full Study Title, Short Study Title, Study Type etc. into a database.
The issues:
1. Each document will have a different name but will be stored in the same location.
2. What is on page 8, for example, in one document is not necessarity going to be the same on every document (due to expanding cells)
3. Each sector is in a separate table but tables can spread across several pages.
4. Some data is stored in a checkbox format rather than text.
5. I dont want to extract all of the data, only certain sections (at least at this stage).
copying all the contents/text from word document and pasted that in the Memo Field, I have a Recruitment database where I have 02 fields on is CV Path (Text Field) that stores the CV Path (Word Document Path) and another text box content (Memo Field) where I would like to copy all the data from the word document to the Content text box (Memo) field.
I have put a Command button on the form...the code to "Copy the content/text" from [CV Path] word document and add it to the "Memo" field.
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.
I am having the strangest results with my automated mailmerge. Basically it does work, but not all the time. The basic idea is to allow the user to dynamically create a query that produces a result list which fills a temporary table. The use then selects a prebuilt merge template and merge is executed against the temp table. The merge template are of the .doc type, but sme have been converted to .docx; the .doc files tend to work most often, but all of the will eventually get a Table is locked message... However if I run in test mode with code breaks and manually step through the process it always works... here is the heart of the code ...
Err_Pos = 10
Code:
DoCmd.SetWarnings False
' if tmp tbl left over from last run kill it
DoCmd.RunSQL "Drop table Word_Merge_Tmp_TBL"
Err_Pos = 12
[Code].....
There are many error cases in the error catch routine. That I have managed to make Access stop hanging when word has a problem or the table is locked. But I can't get the table to be free consistantly and why does it always work when I manually step through the code.
I've created an access chart to show total sales ordered by customers.
I'm using a form with 5 comboboxes to select 5 particular customers from a customer table and pass this information into a query.
This query is then used on a report to create the graph.
Finally there is a button on my form that prints this report.
My problem is that the chart displays the customers in alphabetical order and I would like to order the customers numerically based on total sales value.
If I change my query so that the total sales order by is ascending then when I run the query from the report I am asked to enter a parameter value for the total sales field. Entering nothing and pressing ok simply returns the same graph I would have got had I not changed the order option at all.
*The customer filed in the report is set to group by and my totals field is set to sum - but I need both of these set to produce the graph.
I use the following code to achieve following
a) Open a word document from MS access / VBA,
b) Connect to data from a query
c) mailmerge it
d) Save it as a new document containing mailemerged letters.
The code does open the required document as I can see it open.
I put a message box to recheck that filename/path is what I mean, and to to know till which line the code runs. Code runs till that point and that word doc is seen open. I get the error message before
Then I get error message.
I was fooling around and was getting message " This command is not available because no document is open" I tried to remove few lines thinking redundancy. Before getting the message, I was also getting the error trapping message "No documents opened."
Now I am getting different message.
I am getting message " The remote Server Machine does not Exist or is unavailable"
Following is the code I have written.
Dim xlApp As Object
Set xlApp = CreateObject("word.Application")
xlApp.Visible = True
fn = FormPathName("941 2014 AutoOpen.doc")
[Code] .....
We need to replicate an Access report we have in Microsoft Word. The report has a fixed, small image in the header and so we embedded it in the report (it is not in an external file). To put this image in the Word document the only way we have come up with is shown in the code below.
Code:
Dim apWord As Word.Application
Dim doc As Word.Document
Set apWord = CreateObject("Word.application")
doc.Shapes.AddPicture "G:ImagesSinful Banner.bmp", False, True, 0, 0, 540, 42
Which requires an external image file. We really would like to avoid this. We could make a template Word document, but that too would be an external file. We know how to put this image in a table as an OLE object, but can't find any way to get it from the table into the Word document.
If I use the word template named "ABC.dot" as attached and write the following piece of code to print off the letters with different appropriate background , it works perfectly fine:
Code:
Sub PrintLetters()
Application.DisplayAlerts = False
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim r As Long
Set cn = New ADODB.Connection
[Code] ....
But if I combine two templates together in one template as attached "Capita.dot" then it doesn't display background picture at all in any of the cases. I am using the same piece of code but the background image is not displaying. The background image shows logos for each letter like For capita letters , the logo will be capita . For Friends Life letters the logo background will be different.
I'm using ACCESS 2010. I have a form which is having a embedded word document. What I'm trying to do is i want to enable user to format a mail in the embedded word document which will contain rich text and screenshots then with a click of button an outlook mail should open and content of this document should be pasted there. Once user sends this email, I want to save content of embedded document in the database.
View 4 Replies View RelatedThere are two pages in a word document. All the pages have same headers as attached in word document "Capita.doc". I want to display that header on just first page and on second one page, I want to display watermark stored in "J:PAP107.jpg". The following code displays same watermark on all the pages i.e "J:PAP107.jpg" but I want to keep the header as in the attached word document on first page only and display watermark stored in "J:PAP107.jpg" on second page.
Code:
Private Sub CmdPrint_Click()
Call WordSetupQA("C:CAPITA.dot", "J:PAP107.jpg", Format(DateSerial(ComboBox4, ComboBox3, ComboBox2), "mm/dd/yyyy"), pno)
End Sub
Code:
Sub WordSetupQA(fnTemplate As String, fnBackGroundPic As String, b As Date, a As String)
On Error Resume Next
'MsgBox txtbox
Application.DisplayAlerts = False
Dim strworkbookname As String
strworkbookname = "C:System1.mdb"
Set WordApp = GetObject(, "Word.Application")
[code]....
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.
I've used the Outputto method to archive reports creted in Access to Word in .rtf.
I now want to have an option to view these archives from Access. How?
Thanks,
Richard
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!
When I click a button, I am creating a table for a mailmerge and then calling the document that merge is in so I can write letters.
Everything works properly except the line for calling a document. I've messed with it in several ways but right now it tells me I need an equal sign. Can someone who actually knows VB (I'm just pretending! ) look at this and tell me what might be wrong?
Shell("C:Program FilesMicrosoft OfficeOffice10WINWORD.EXE", "\documentsOfficesJudicial & Court ServicesJudicial CollegeShared Project FoldersTemplatesLetters & AccessoriesConf Letter Mail Merge.doc")
Thanks!
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?
I'm trying to work out how to attach a word doc to the attachment field of a table when I add a new Record. The following code work's fine if I add it to the On Load Event on the Form, but the doc is attach'd to the first record. When I add the code to the Add New Record button, I get the error msg: "File already part of the Multi-Valued Field" and nothing in the attachment field.
Code:
Private Sub Add_Record_Click()
DoCmd.GoToRecord , , acNewRec
Me.Description.SetFocus
On Error GoTo Err_AddImage
Dim db As DAO.Database
Dim rsParent As DAO.Recordset2
Dim rsChild As DAO.Recordset2
[Code]...
Apologies ... but I am quite new to Access. My database contains about 1000 peoples' addresses.
The problem I have is that I need to merge, say, 20 of these addresses into a word document. In the word document I can select records using the "Surname" field but it will not give me the option to select more than 6.
I am sure there must be a way that I can select more than 6: I have tried separating the surnames with a "," or "or" but nothing seems to work!
Help, please!
Thank you,
Emma
Hi....
I have created an Access Form wherein i have given lots of text box and text areas...
Now i want to create a word document dynamically using the information that has been given by the user via the Access form...
I want to create a Table dynamically in the Word Document using the VB code behind an access form... Also through that code i want to manage the font of Word Document and most if its controls..
Can u plz help me in this or provide me with a document wherein i can get some info in regard to it i.e. to manage the Word using Code...
Thanking you,
with regards,
Kapil Sharma
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.
Is there a quick way to export ALL VBA code to a text file/word document?
View 5 Replies View RelatedHi....
I have created an Access Form wherein i have given lots of text box and text areas...
Now i want to create a word document dynamically using the information that has been given by the user via the Access form...
I want to create a Table dynamically in the Word Document using the VB code behind an access form... Also through that code i want to manage the font of Word Document and most if its controls..
Can u plz help me in this or provide me with a document wherein i can get some info in regard to it i.e. to manage the Word using Code...
Thanking you,
with regards,
Kapil Sharma
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.
How is it possible to open a form letter word docment from an Access form in which information on the form (such as name and address) is used in the letter?
View 3 Replies View RelatedIs it possible to link a field in Access to a footer in Word?
I have a field in Access that would look like the following;
G10E-PRO-001RevA
Additional data in access would have the document name, and revision, matching 2 lines of text in Word. I would like the footer in the document to be the above sample, which I assume could be a query that need to run to match the 2 fields of information.... not really sure if this is even possible?
I need to be able to embed an interactive word document in an access form. The need is to put in text that has underlines and strikethroughs to indicate name changes to policies.
The user creates a new proposed update by designating the policy number but I need a word file attached to this update that can show more punctuation than access can show.
Of course I want to make this as automated as possible so the user doesn't have to work in two different places to get this done.