Modules & VBA :: Send Form Fields To Word Template?

Jul 2, 2015

I have a form with fields that contain the address/postcode etc of the person in question, and I also have a template letter that needs to have said persons address/postcode etc at the sending stage after a button is clicked.

View Replies


ADVERTISEMENT

Modules & VBA :: How To Save Word Template As HTML

Apr 29, 2014

I'm using the below to merge an access form into a word template (it's a starter for 10).

That works fine. What I need to do is save the word template as HTML so I can then upload it to my website.

Dim wordApp1 As Word.Application
Dim docPath1 As String
Dim fileName1 As String
Dim PageName As String
PageName = Forms!Frm_Page_Create![Page]
docPath1 = Application.CurrentProject.Path & "Merges"

[code]....

View 1 Replies View Related

Modules & VBA :: Filling Excel Template Cells / Save Then Send On Outlook

Jul 13, 2013

I have the code below which takes information from a form on access and sends it over to the correct place on an excel spreadsheet template. This works fine but I then need it to save and send on outlook.

The issue I am having is that the saved document is not attaching to the e-mail. The subject etc all work fine but the excel spreadsheet just doesn't attach. When I go into the folder I have specified for the document to be saved in it isn't there either. :0(

The code for the e-mail "callmail" function works perfectly for word documents but I don't know if it is different for an excel file.

Code:

Private Sub Command154_Click()
On Error Resume Next
Dim appExcel As Excel.Application
Dim wbook As Excel.Workbook
Dim wsheet As Excel.Worksheet
Set appExcel = New Excel.Application

[Code] .....

View 4 Replies View Related

Modules & VBA :: How To Insert Data From Access To Word Template

Jul 28, 2013

I'm doing a project for my work. I created a few reports in Access. Some of these reports are simple graphic bars. How can I insert these reports into a word document template?

View 2 Replies View Related

Modules & VBA :: Export Single Record To MS Word Template

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

Modules & VBA :: Change Check Box Values Of -1 To YES And Then Fill Word Template

Jul 26, 2013

I have the following VBA code that auto populates a word template:

Private Sub Command24_Click()
On Error GoTo ErrorHandler:
ErrorHandler:

[Code].....

The code executes flawlessy but there are three values that are based off check boxes set as YES/NO (EMPLOYEDATREGISTRATION, EMPLOYED and FRINGEBENEFITS). These values show up as -1 for YES and 0 for NO.

Is there anyway to add code to mine that would allow me to change these values before they are sent to the Word template?

View 10 Replies View Related

Populating Word Template From Form In Access

Mar 7, 2013

I am creating a db for my work place that records incidents that take place. I am a novice at Access but I have made different tables, queries, forms and reports and they all work.

I was wondering if there was a way to extract data that a user enters into a form and then use that to populate a word template *without* coding using VBA? I am really a beginner and not confident with VBA at all. I have read the forum and that seems to be an option (but would rather something else if possible!)

View 3 Replies View Related

Modules & VBA :: How To Send Embedded Word Document As Email

Dec 17, 2013

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 Related

Form Data To MS Word & Protecting The Form Template

Dec 18, 2006

Thanks to some of the threads here, I have managed to automate inputting form data from a record into bookmarks in a word document template (a letter). What I am trying to do is to lock the letter allowing modification only to the form fields in that template. If the original template is locked (allowing entry only in the fields), the data does not flow through. So I was trying to accomplish this through the "ProtectedForForms" property. However, it does not work. The letter gets locked before the information flows through. Here's the code I am trying to use (borrowed from one of the users here):

Private Sub cmd_letWarn_Click()

' Check for empty fields and unsaved record.
If IsNull(occupant) Then
MsgBox "Occupant Name cannot be empty"
Me.occupant.SetFocus
Exit Sub
End If

If IsNull(propad_no) Then
MsgBox "Building Number cannot be empty"
Me.propad_no.SetFocus
Exit Sub
End If


If IsNull(prop_ZIP) Then
MsgBox "ZIP Code cannot be empty"
Me.prop_ZIP.SetFocus
Exit Sub
End If

If Me.Dirty Then
If MsgBox("Record has not been saved. " & Chr(13) & _
"Do you want to save it?", vbInformation + vbOKCancel) = vbOK Then
DoCmd.RunCommand acCmdSaveRecord
Else
Exit Sub
End If
End If

' Create a Word document from template.
Dim WordApp As Word.Application
Dim strTemplateLocation As String

' Specify location of template
strTemplateLocation = "T:PlanningPlanningEnforcementLogsuppfiles emp warn.dot"


On Error Resume Next
Set WordApp = GetObject(, "Word.Application")
If Err.Number <> 0 Then
Set WordApp = CreateObject("Word.Application")
End If
On Error GoTo ErrHandler


WordApp.Visible = True
WordApp.WindowState = wdWindowStateMaximize
WordApp.Documents.Add Template:=strTemplateLocation, NewTemplate:=False

' Replace each bookmark with field contents.
With WordApp.Selection


.Goto what:=wdGoToBookmark, Name:="ownername"
.TypeText [occupant]

.Goto what:=wdGoToBookmark, Name:="bnum"
.TypeText [propad_no]

.Goto what:=wdGoToBookmark, Name:="stname"
.TypeText [propad_street]

.Goto what:=wdGoToBookmark, Name:="zipcode"
.TypeText [prop_ZIP]

.Goto what:=wdGoToBookmark, Name:="pbnum"
.TypeText [propad_no]

.Goto what:=wdGoToBookmark, Name:="pstname"
.TypeText [propad_street]

.Goto what:=wdGoToBookmark, Name:="ppn"
.TypeText [parcel_no]

.Goto what:=wdGoToBookmark, Name:="ordinance"
.TypeText [code_sections]

.Goto what:=wdGoToBookmark, Name:="orddesc"
.TypeText [complaint_typ]

.Goto what:=wdGoToBookmark, Name:="ownername2"
.TypeText [occupant]

.Goto what:=wdGoToBookmark, Name:="officer"
.TypeText [officer_name]


End With

DoEvents
WordApp.Activate
WordApp.ActiveDocument.ProtectedForForms = True


Set WordApp = Nothing
Exit Sub

ErrHandler:
Set WordApp = Nothing

End Sub

Thanks in adavance for any help.

View 3 Replies View Related

Modules & VBA :: Populate Word Fields From Access Continuous Form

Jun 3, 2015

I have a form that I have exported certain fields into a word doc (it is up and running just fine). I created bookmarks in word and put some VBA into my access form, so when I click on 'Create word report' it pops up and automatically populates the record I am on. Here is the tough question,

How to make this work with a continuous form? My main form has several subforms, one being a continuous form. The main form shows one bridge at a time. The sub continuous form shows information for all of the bridges spans (could be anywhere from 1 to 9).

View 4 Replies View Related

I Have A Template In Word

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

Link To A Word Template

Jan 23, 2008

Hi I have a database and I want to basically use table fields to load into a Word template and I want this done via code, i.e a button....any help very much appreciated!

View 1 Replies View Related

Linking Access To A Word Template

Feb 16, 2006

i have a form and was wondering if it was possible to take some of the fields and drop them into a template word document from inside access. so as to create a button that when clicked opens up the template and transferes the wanted form data.

any idears how to automate this process would be greatly appreciated

thanks in advance john

View 2 Replies View Related

Reports :: Exporting Data To Word Template

Apr 7, 2014

I have a Word template that I require my data to be exported to. Is there a way to import a .docx into a report design?

View 1 Replies View Related

Problem With Make Table Query And Merge To Word Template

May 23, 2005

Hi guys!

I have my word template set up such that some data is copied from the open form into the document and some data is taken from a table which is created from a query based on the content of the form (the record number). This works well HOWEVER (there's always a however isn't there :rolleyes: ) where two users click on the button at exactly the same time or within a very short space of time the query only runs once and either the database crashes (bad) or the document is created for the second person with the wrong data (very bad).

How can I make it so that only one person can run the query at a time (ideally build in a delay in processing so that the query will run for them when the first person has finished...failing that a message to say please try again later)? They will always be working with a different record.

I'm a bit stuck as to what to search for in the forum for an answer to this so haven't really searched.....sorry :(

Many thanks
Jo

View 2 Replies View Related

Reports :: Filling Report Based On Specific Word Template

Jan 13, 2014

I was thinking today if it is possible to fill Access reports based on a specific Word template? I don't want to populate a Word file with Access data as users of my app might not all have Word. Or is there another solution using a WYSIWYG editor where users can format everything according to their needs? That would be fantastic.

View 2 Replies View Related

Modules & VBA :: Static Webpage Form - Export To HTML Using Template

Mar 12, 2014

In my DB I have a query that I need to create a static webpage from, now in excel I can do the record button and bingo, but access is a lot more confusing.

I have a template named doc_tplt.html that when I do the export from the query it creates the webpage using this template.

I want to have a form with a selection of command buttons on it to export to html using the template for various queries and tables.

What is the VBA code to export the query (qry_docs) and apply the template (doc_tplt.html) and save to the same directory as the DB itself.

View 2 Replies View Related

Send Subform Contents To MS Word

Apr 21, 2006

can anyone tell we how to send the data from a subform to word, using a button on the main form? I'm using access 97

View 1 Replies View Related

Send Record To Word Document

Jun 8, 2007

OK - bit of a newbie here & maybe this question has been asked a thousand times but i can't find any answers that cover this question properly.

Basically i am writing an access database that stores contract information, contact details, orders etc etc. I want to take the Order Number field, along with the Client Name & Address etc and post it into a Word Mail Merge type document, then save that file as ordernumber.doc after checking to see whether it already exists.

I have successfully managed to send the information into word in a mail merge document & get it to save the file using the ordernumber.doc format, however it is saving it to mydocuments folder and i want it in a subfolder called orders (that does exist). It is also not checking to see if that file already exist and overwrites it if it does.

I want to change the path to where the file is being saved, check whether it exists already, then ask me whether i want to overwrite it or save as something else.

Any help would be most appreciated. BTW I am using Word & Access 2003.

*****THIS IS THE CODE I AM USING*****
Private Sub NewEternit_Click()
On Error GoTo NewEternit_Err

Dim objWord As Object

'Start Microsoft Word.
Set objWord = CreateObject("Word.Application")

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

'Open the document.
.Documents.Add ("\shentcDocuments and SettingsJohn.SHENTMy DocumentsTemplatesEternit Order Merge.dot")

'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("orderno").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!ContractNo) & "/" & (Forms!frmOrderDetails!OrderNo))
.ActiveDocument.Bookmarks("Date").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!Date))

If Me.chkDeliverYard = False Then

.ActiveDocument.Bookmarks("ClientName").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!ClientName))
.ActiveDocument.Bookmarks("SiteReference").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!SiteReference))
.ActiveDocument.Bookmarks("SiteAddress1").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!SiteAddress1))
.ActiveDocument.Bookmarks("SiteAddress2").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!SiteAddress2))
.ActiveDocument.Bookmarks("SiteAddress3").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!SiteAddress3))
.ActiveDocument.Bookmarks("Town").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!Town))
.ActiveDocument.Bookmarks("City").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!City))
.ActiveDocument.Bookmarks("Postcode").Select
.Selection.Text = (CStr(Forms!frmOrderDetails!Postcode))

Else

.ActiveDocument.Bookmarks("ClientName").Select
.Selection.Text = "OUR YARD"
.ActiveDocument.Bookmarks("SiteReference").Select
.Selection.Text = ""
.ActiveDocument.Bookmarks("SiteAddress1").Select
.Selection.Text = ""
.ActiveDocument.Bookmarks("SiteAddress2").Select
.Selection.Text = ""
.ActiveDocument.Bookmarks("SiteAddress3").Select
.Selection.Text = ""
.ActiveDocument.Bookmarks("Town").Select
.Selection.Text = ""
.ActiveDocument.Bookmarks("City").Select
.Selection.Text = ""
.ActiveDocument.Bookmarks("Postcode").Select
.Selection.Text = ""

End If

'Print the document in the foreground so Microsoft Word will not close
'until the document finishes printing.
'objWord.ActiveDocument.PrintOut Background:=False

' Save the file using orderno field
Dim FName As String
FName = Forms!frmOrderDetails!OrderNo & ".doc"

'Quit Microsoft Word and release the object variable.
'objWord.Quit
'Set objWord = Nothing

End With


Exit Sub
**** END OF CODE****

View 4 Replies View Related

General :: How To Copy Picture On Attachment And Send It To MS Word

Jul 11, 2012

I want to copy the file stored on a attachment field (.jpg), so i can use it on a Word document as a picture.

I've tried it with bookmarks but no success:

' 'Paste the photo.
.ActiveDocument.Bookmarks("EidPhoto").Select
.Selection.Text = GetPath & "RE EIDPicture" & OwnerFullName & "_eid.jpg"

Then I only get the path of the file, Is there a control that i have to use?

View 1 Replies View Related

Modules & VBA :: Send Function Variable Back To Form

Apr 30, 2014

I have some code in a form that calls for a public function and passes on some values. the function makes some calculations and assigns a value to the variable "percent" in the function itself.

How can I get the value of this variable back in the form so I can use it?

Form:

Code:
Private Sub Form_Open(Cancel As Integer)
Dim Table As String, TotalFields As Single
Table = "tblAdmission"

[Code]....

View 5 Replies View Related

Modules & VBA :: Pick ArrayID From A Form And Send Corresponding X And Y Values To Excel

Jun 13, 2013

I have hit a roadblock trying to send data to excel. I have created a table of Arrays where each record has an ArrayID, a record ID, an X unit and a Y unit. I want to be able to pick an ArrayID from a form and send the corresponding X and Y values to excel as part of a Linest calculation.

View 3 Replies View Related

Modules & VBA :: Import Word Form Data

Nov 26, 2013

I am using the follow code to import data from a Word form into my MS Access 2010 DB:

Code:
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tmpSIRs", dbOpenDynaset)
With rst
.AddNew

[code]...

On the Word Form, these two fields are drop-downs with three options: blank, No, and Yes. If the users leaves them blank, then Access ignores them--which is what I want. However, if the user says yes or no, Access puts a "-1" in the database. Both the Word form and Access field are text.

View 2 Replies View Related

Adding Fields To Template Tables / Forms

Jul 14, 2014

Is there a way to add fields to template tables/forms? The table will only show in datasheet view; design view isn't an option...

View 1 Replies View Related

Modules & VBA :: Automating Mailmerge From Access Form To Word Document

Aug 5, 2013

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.

View 4 Replies View Related

Modules & VBA :: Get Data From Microsoft Word Document And Paste It Into Form

Jun 14, 2014

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.

View 1 Replies View Related







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