Modules & VBA :: Word Naming And Emailing Attach From Access 10?

Apr 21, 2015

I need to create a word file (it needs to be word) based on template (not a very complicated template) max 1 to 1 and 1/2 pages long.

the word doc needs to be named from the recordset but for now assume 12345.doc and the next one will be 12346.doc etc (I have a unique number system - available from tables /query .

i can either make the word doc in code or use a template (template would be better) recordset could have 20-30 in it each time i run it - but to be run every week

second half is how to email this out. i had in mind a email system

email to . test@testhotmail.xyz
file attach = this folder where the docs are store and attach 12345

in a loop

so either

create word file - email word file in a loop each time or create all the word files and then send them individual

View Replies


ADVERTISEMENT

General :: How To Attach Pdf To Word

Oct 30, 2014

I want to attach a pdf file at the end of my word document by clicking a button from form.

View 3 Replies View Related

Modules & VBA :: Unable To Attach A Report To Access Email

Nov 2, 2014

getting to grips with the code a bit more now, but now I cannot get the report which is generated to attach to the email

running ms access 2010

View 1 Replies View Related

Modules & VBA :: Naming Range To Export Data To Access Table?

Dec 15, 2014

I am trying to write code in an excel worksheet to try to export excel data to a table in access.

The range in which the data is situated in excel varies. So the range address varies with the data. After a lot of searching I wrote the following code which works for a range which is fixed. The code is the following:

Dim acc As New Access.Application
Range(Range("b22"), Range("b22").End(xlDown)).Select
ActiveWorkbook.Names.Add Name:="ghazla", RefersTo:=Selection
acc.OpenCurrentDatabase "D:PayRollFactoryJasminePayroll.accdb"
acc.DoCmd.TransferSpreadsheet _

[Code] .....

As one can see from the first two lines of code I am trying to first delineate the range and then to name it. The intent is to name the range "ghazla" and so to cater for the fact that the extent of data varies.

The code works with the fixed range ="Sheet2$B140". However what I need to do is to adjust the code so that I can insert "ghazla" as the range name so that this can vary.

View 5 Replies View Related

Modules & VBA :: Attach Internal Access Report To Email Item

Dec 5, 2014

I have a subroutine that works well for sending emails. A need has arisen to, in some cases, send an Access report as a PDF attachment. I know how to do this using the SendObject method, but that won't work in this app. I also don't want to have to first save the report as a pdf file. I think I'm close, but I don't know the syntax for passing the report name as the Source parameter in the Attachments.Add method.

Code:
If strEmailAddress = "jsmith" Then
.Attachments.Add source:=MyReportName, type:=acFormatPDF
End If
On Error GoTo SendErr
.Send
On Error GoTo 0

View 4 Replies View Related

Modules & VBA :: Emailing From Within Access?

Aug 29, 2014

I am trying to automate the process of sending a query result via email.

I have code that will export a query as an excel document, using DoCmd.SendObject, but it has the name of the query.

DoCmd.SendObject acSendQuery, "Dailyrpt", acFormatXLSX, email.address, , , "Daily Report", "This is today's report", -1, False (email.address would actually be the email address it is being sent to.)

I also have code that will export the query to excel and save it as a file, using DoCmd.OutputTo, where I was able to name it something meaningful to the end user, and include the date.

DoCmd.OutputTo acOutputQuery, "Dailyrpt", acFormatXLSX, "Z:FolderComplete as of " & Format(Date, "yyyymmdd") & ".xlsx"
Dim Foldername As String
Foldername = "Z:FolderComplete as of " & Format(Date, "yyyymmdd") & ".xlsx"
Shell "C:Program Files (x86)Microsoft OfficeOffice14EXCEL.exe """ & Foldername & "", vbNormalFocus

Is there a way to either send the saved (renamed) file or to include the current date as part of the SendObject command?

View 4 Replies View Related

Emailing Dynamic Word Document

Mar 31, 2014

Currently, I have a form with a button that sends emails to all records in a given record set. My email message is hardcoded, and it has dynamic fields that are different for each record. For example, "Dear rs![First Name], you have been placed in rs![Group Name]..." I have set this up in visual basic as an email object, and my .To field is set to rs![Contact Email Address]

Is it possible for me to put my email message in a Word document (so that it can be edited without going through the visual basic editor) and then either attach it to each email or put it in the message body (while still maintaining the dynamic fields)?

View 2 Replies View Related

Modules & VBA :: Automatically Attach External File To Email Generated By Access Database

Nov 24, 2014

I have an Access 2013 database which will generate a pdf report and attach it to an email using the code:

Code:
DoCmd.SendObject acSendReport, "Report Name", acFormatPDF, Nz(To email address, a), , , "Email Subject", "Email body", True

I would also like to automatically attach on the server to this email. Such a file stored such as servernamesharefilename.pdf. Is it possible to do this?

View 14 Replies View Related

Modules & VBA :: Exporting And Emailing From Access

Jul 18, 2013

i am very new to access, but i can code in excel well.what i really want to do is no how to automatically email a report, query or table. I also would like to be able to export the above three to excel as well. I have worked my way up a little bit but my hair is falling out with how hard this is to achieve. I have come up with the following so far:

Code:

Dim outputFileName As String
Dim oXL As Object
Dim oExcel As Object
Dim sFullPath As String
Dim sPath As String

[code]...

The above code works a bit, but it only allows me to export tables (dont know how to modify it). It also doesnt open the table in excel properly, it opens excel, but the table doesnt open. I have to go to the location and manually open it.

View 6 Replies View Related

Modules & VBA :: Naming New Archive Table

Jan 8, 2014

I have a Database in which I would like to archive data once it is now longer actively being used. I have VBA code that does everything i need it to, however I would like to name the new archive table related to the dates in the data being archived. Below is the code I am using to archive and delete the information from the main table.

Code:
Dim strSQLCreate As String
Dim strSQLDelete As String
Dim strArchiveTableName As String

[Code].....

I know it will be in the "strArchiveTableName" variable, I am just not sure how to pull the dates out of the data being moved. The TestData table holds a date and time for each test, and the earliest and latest dates is what i want to append to the table name.

For example: Currently "tblTestData_A102Archive"What I want "tblTestData_A102_1/1/2012-1/1/2013"

View 3 Replies View Related

Modules & VBA :: Naming A File - SOW Number

Oct 23, 2013

I'm currently working with Access 2007 building a way to create PODs to clients. I have most everything laid out, one problem I can't seem to get around is naming the file the SOW #. Below is the code:

Function Run_all_PODs_01()
Dim myPath As String
Dim name As Object

DoCmd.OpenQuery "Q5 SOW bill requested data points all", acViewNormal, acEdit
DoCmd.OpenQuery "Q5 SOW bill requested All 01", acViewNormal, acEdit

[Code] ...

I can't seem to get the name to equal the SOW number.

The table that I'm trying to reference is "SOW bill requested data points" it is a basic table one row with a column header as SOW #. I'm not sure how to tell it name the file that data point in the column.

View 4 Replies View Related

Modules & VBA :: Export To Word From Access

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

Modules & VBA :: Output Report To Excel With Naming

Aug 19, 2013

Been hunting a round looking for some code that will output my access report to excel but more inportantly add a unique field from the report to the name of the file. example would be [FileName] & [ReferenceNo].xls.

View 2 Replies View Related

Modules & VBA :: Excel Export Naming Convention

Jun 8, 2015

I would like to add the "Month" of the information queried to my file name at export if possible. I included my current code and an example of how I would like the title to read.

DoCmd.TransferSpreadsheet acExport, 10, "tblStarzIncentivePayoutExport", "C:StarzExportsIncentive Payouts" & " " & "Ran" & " " & Format(Date, "mm-dd-yyyy")

I would like the file to be named:

Incentive Payouts "Month out of the date ran in the query" Ran 06/08/2015

Is it possible to do?

View 1 Replies View Related

Modules & VBA :: Word Automation From Access - Tables

Aug 1, 2013

I have just started to develop a database that will export data directly into a word template. I have used Word automation quite a lot but I'm new to trying to automate Word from Access.

It's going OK at the moment, I have got the db to open up the template, write data and then close. My objective is to add the data to multiple tables within word. So I have created several tables in my word template and then tried to select these tables and write to the them. Everything is thing for the first table but for any other table I get an error message saying that the member of the collection doesn't exit i.e. the table isn't there. I select the table using:

Code:
objWord.selection.tables (2).select

I then used:

Code:
objWord.selection.tables.count

To show how many tables were in the document and it doesn't matter how many there are, it always says there is 1 table.

why it can only see 1 table and what I can do to get around it?

View 2 Replies View Related

Modules & VBA :: Scan PDF Document From Scanner And Attach It To Field

Oct 12, 2014

I have hp scanner whose twain driver has the option to scanning in the pdf document.

Microsoft WIA 2.0 have save scanned document only to graphical format.

I want automated (on click any button control) to scan multipage document from glass source or ADF to pdf document and attach it to attachment field.

I'm found VB Module for accessing TWAIN compatible scanner but it is call twain software and scan to bmp format with assigned name of file.

Me need it also only use the pdf format .

View 7 Replies View Related

Modules & VBA :: Attach Multiple Items To Outlook Email

Aug 6, 2015

I am currently in the process of creating a form that will allow you to enter details for an email sent, select a number of documents from a list box and then open the mail message pre-written with attachments. The attachments reside in a list box currently, and I am attempting to use a "For Each" with item selected.column(3) as the file path, as column(3) contains the filepath from the table.

Currently my code is:

Private Sub OutlookBut_Click()
Dim olApp As Object
Dim objMail As Object
Dim varItm As Variant
On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")

[Code] ....

When this code runs, outlook will open as a process when it is closed, but then freeze and not allow me to see it or access it in anyway. If Outlook is opened Microsoft office usually gets angry at me and decides to throw error messages at me.

View 2 Replies View Related

Modules & VBA :: How To Loop Through Recordset And Only Attach Records That Are True

Jul 8, 2015

I have some code that loops the clone recordset of my subform and generates a email with attachments. I have mainform and continuous subform within the subform I have field called address this holds paths to files and another field called send and this is a yes/no field

Now what I'm trying to do is loop through the subform if send field is true then attach file from the address path but if send field is false then do not attach file

Code:
Dim olApp As Outlook.Application
Dim olMail As Outlook.MailItem
Dim olAttach As Outlook.Attachment
Dim rstAttach As DAO.Recordset

Set olApp = New Outlook.Application
Set olMail = olApp.CreateItem(olMailItem)

[Code] ....

View 14 Replies View Related

Modules & VBA :: How To Attach PDF Report To Existing Outlook Template

May 20, 2015

Am working in MS Access 2013 and I have a form with a button, I need the button to doattach automatically the pdf-report to the email template(i don't want to attach the pdf to a new email)

Right now the command open the E-mail template and create the pdf-report in the desktop

Code:
Private Sub Command18_Click()

Dim oApp As Outlook.Application
Dim oMsg As Outlook.MailItem
Dim oAttachment As Outlook.attachment
Set oApp = New Outlook.Application

[Code] .....

View 3 Replies View Related

Modules & VBA :: Check For Documents With Specific Naming Structure

Apr 30, 2014

I want to hit a button and then it scans for a file on a server and return with a message box saying if it exists or not.

I want it so when I am on a Specific record it will search for certain requirements.

All the file names are pdf files with the same naming structure

SIT yy m(m) dd Last Name Unique Identifier
Example:
SIT 14 5 21 Smith ABCD1234567
SIT 14 10 21 Smith ABCD1234567

So I hit the button it sweeps the file path and looks for documents with this naming structure.

Last Name and Unique Identifier are fields within the db.

Last Name = txtLName

Unique Identifier = txtUniqIden

So far I have the following:

Code:
Dim strDirName As String
Dim strDirPath As String
Dim strDirName As String
Dim strDirPath As String

[Code] ....

So Far it works and I used the actual name of the items an it finds them but I need to up each record.

I have no clue how to begin with the strDirName. How to get it to scan the file name in a specific format.

View 3 Replies View Related

Modules & VBA :: Access Mailmerge To Word Including Image

Nov 25, 2014

I have a database of film events, for which i have to do posters.

With the click of a button on a form, access opens word and puts all the fields in, including a field called [photo], which is the name of the image stored outside of the database.

Is there a way of getting that image into the word Document with all the other fields? Or have I just wasted an afternoon....

View 2 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 :: Mail Merge In MS Word (using Data From MS Access)

Mar 9, 2014

I often create contract using mail merge. I have an access file that I want to use as data source for word file. But it does not automatically.

Please see the attached file !

If there are 1 customer and 1 property, I do not need to do anything. Conversely, if there are many customers and many properties, I take time to manipulate.

Firstly, I open the word file. I have to copy and paste paragraphs that I want. Highlight of the original paragraphs is blue.

Secondly, I click 'Insert Word Field' -> select 'Next Record'.

In short, I want to use VBA in access file to automatically perform the steps that I have outlined.

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

Modules & VBA :: Setting Up Certificate Request Database - Attach PDF To Form

Aug 11, 2015

I have been tasked with setting up a certificate request database. I have an Access 2032 FE & SQL 2012 BE. I need to store PDF documents from all our branches.

I have been working on this for the past 3 working days and I have seen a great deal about saving the file path to the database vs saving the actual document in the DB. The documents would be located on each users computer.

I have a Form with all the information that is required by the certification department. On the form is a button (Called InsertID(ID in this case is the persons Identity Docuement)) and the button is linked to a table called dbo_CertificationSupportingDocuments. The table is referenced to the Main Certificate Request table.

The dbo_CertificationSupportingDocuments table is structured as follows:

Code:
[CertSupportingDocID] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
[CertificateRequestNumber] [numeric](18, 0) NOT NULL,
[RequestBlob] [varbinary](max) NULL,
[RequestFileName] [nvarchar](50) NULL,
[RequestFileExtension] [nchar](10) NULL,
[RequestFileMimeType] [nvarchar](50) NULL

When I click the button I get a Run Time error 3075 "Syntax error (Missing operator) in query operator.

The code I am using is:

Code:
Dim fd As FileDialog
Dim strFileWPath As String
Dim FileNoExt As String
Dim FileExt As String
Dim StrSQL As String
Dim db As Database

[Code] ....

I have been looking at this code for so long that I cannot see what is wrong.

View 14 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







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