天道酬勤,学无止境

mailmerge

调用 MailMerge.OpenDataSource() 设置连接(Call MailMerge.OpenDataSource() Set Connection)

问题 我想打开一个 Word 文件并将其连接到 Excel 文档中的第三个表作为邮件的数据源。 我的主要问题:如何设置“Table3”以避免打开此对话框? 这是我的试验(全部作为 # 后面的评论): $Word = New-Object -Com Word.Application $Word.Visible = 'TRUE' $Doc = $Word.Documents.Open( "D:\GoogleDrive\_POWERSHELL\Template.doc" ) $Doc.Activate() $DataPath = "D:\GoogleDrive\_POWERSHELL\DataSource.xls" $DataTable = "Table3" $default = [Type]::Missing #1 $Doc.MailMerge.OpenDataSource( "D:\GoogleDrive\_POWERSHELL \DataSource.xls" ) #this works fine but opens a box to choose the table #2 $Doc.MailMerge.OpenDataSource( $DataPath ) #this works fine too but opens a box to choose the table #3

2021-09-18 02:21:45    分类:技术分享    powershell   mailmerge   method-parameters

调用 MailMerge.OpenDataSource() 设置连接(Call MailMerge.OpenDataSource() Set Connection)

问题 我想打开一个 Word 文件并将其连接到 Excel 文档中的第三个表作为邮件的数据源。 我的主要问题:如何设置“Table3”以避免打开此对话框? 这是我的试验(全部作为 # 后面的评论): $Word = New-Object -Com Word.Application $Word.Visible = 'TRUE' $Doc = $Word.Documents.Open( "D:\GoogleDrive\_POWERSHELL\Template.doc" ) $Doc.Activate() $DataPath = "D:\GoogleDrive\_POWERSHELL\DataSource.xls" $DataTable = "Table3" $default = [Type]::Missing #1 $Doc.MailMerge.OpenDataSource( "D:\GoogleDrive\_POWERSHELL \DataSource.xls" ) #this works fine but opens a box to choose the table #2 $Doc.MailMerge.OpenDataSource( $DataPath ) #this works fine too but opens a box to choose the table #3

2021-09-18 02:17:36    分类:技术分享    powershell   mailmerge   method-parameters

VBA MS Word - Insert all mail merge fields into Word doc at once

Currently MS Word only allows for the insertion of 1 mail merge field at a time. I am looking for a VBA code that would allow me to insert all merge fields into a Word doc at once and/or a code that would input a mail merge field where the name of the same mail merge text appears in the doc. For the second possibility I have found the following code that allows the user to convert text that matches a mail merge name into a mail merge field one at a time ( http://apsona.com/blog/how-to-quickly-create-merge-fields-in-word/ ). I am dealing with a data source that contains thousands of mail merge

2021-09-07 19:50:01    分类:问答    vba   ms-word   mailmerge

Running Mail Merge from Excel on an Embedded .docx (Word) file

Please help on figuring this out as I'm stuck at the last stage trying to properly define my variables in the following code. I want to execute the following in sequence: Click the button 'CommandButton1' The Form called 'CR_MMFormTest', which is an embedded document, will then open (mergefields already completed with no datasource pointed at, at the moment) VBA helps me create a replica of the Form, and use that for.... Calling the function DistrictMailMerge The problem, I encountered, lies on 3, and 4. The replica script does not work for an embedded document. It would say Run-time Error

2021-09-07 08:01:01    分类:问答    excel   ms-word   mailmerge   vba

Call MailMerge.OpenDataSource() Set Connection

I want to open a Word file and connect it to the 3rd table in an Excel document as data source for mailing. My main problem: how can I set the "Table3" to avoid opening this dialog box? Here my trials (all as comments behind #): $Word = New-Object -Com Word.Application $Word.Visible = 'TRUE' $Doc = $Word.Documents.Open( "D:\GoogleDrive\_POWERSHELL\Template.doc" ) $Doc.Activate() $DataPath = "D:\GoogleDrive\_POWERSHELL\DataSource.xls" $DataTable = "Table3" $default = [Type]::Missing #1 $Doc.MailMerge.OpenDataSource( "D:\GoogleDrive\_POWERSHELL \DataSource.xls" ) #this works fine but opens a box

2021-09-04 08:25:42    分类:问答    powershell   mailmerge   method-parameters

使用邮件合并添加抄送和密送(Add CC and BCC with Mail Merge)

问题 我正在尝试将 cc 函数添加到邮件合并中。 换句话说,我不仅需要将电子邮件个性化到不同的电子邮件地址。 我还希望每封电子邮件都包含一个抄送,向多个收件人显示相同的电子邮件。 示例:发给 John Doe 的同一封电子邮件可以自动抄送给他的经理。 我尝试添加 , 和 ; 以及将excel中的两个单元格与地址合并并出错。 我还阅读了一篇文章,该文章展示了如何将附件发送给多个收件人并对其进行了修改以使抄送工作。 请参阅下面的文章。 http://word.mvps.org/FAQs/MailMerge/MergeWithAttachments.htm 我想出的代码如下所示。 它允许我抄送,但是,它只通过第一行电子邮件,其余的都没有。 消息的正文也不显示。 任何指针? Sub emailmergewithattachments() 'Global Config Variables Dim saveSent As Boolean, displayMsg As Boolean, attachBCC As Boolean saveSent = True 'Saves a copy of the messages into the senders "sent" box displayMsg = False 'Pulls up a copy of all messages to be sent

2021-09-01 16:28:51    分类:技术分享    excel   vba   email   mailmerge

在 WinForms App 中编译 ASPX(Compile ASPX in WinForms App)

问题 我正在编写一个发送电子邮件的 WinForms 应用程序(如邮件合并)。 我想使用 ASP.Net 的呈现引擎来呈现消息的 HTML 正文。 在没有整个 ASP.Net 运行时的情况下获取单个 ASPX 页面的呈现输出的最简单方法是什么? 更麻烦的是,我更愿意在运行时编译 ASPX,这样就可以在不重新构建应用程序的情况下对其进行修改。 然而,这不是必需的; 如果太难,我就放弃。 回答1 Rick Strahl 在此位置发布了一篇关于如何执行此操作的文章:http://www.west-wind.com/presentations/aspnetruntime/aspnetruntime.asp。 我知道有一种方法可以调用一些内部 .NET Framework 方法,但我不记得它们是什么。 回答2 您可能需要考虑使用像 NVelocity 这样的模板库。 以这种方式使用 WebForms 渲染引擎充其量有点矫枉过正。 顺便说一句:请记住,电子邮件中的 HTML 很糟糕。 大多数电子邮件客户端甚至忽略了最基本的 CSS。 如果您需要我的建议,请亲吻并保持理智:如果您要自动发送电子邮件,请仅发送纯文本。

2021-07-12 11:28:45    分类:技术分享    c#   asp.net   winforms   email   mailmerge

Access / Word 2010 VBA 邮件合并尝试打开 [Foldername].mdb 而不是 ACCDB 源(Access / Word 2010 VBA Mail Merge Tries to Open [Foldername].mdb Instead of ACCDB Source)

问题 我们正在尝试从 Access 中自动执行邮件合并过程 - 单击按钮后,VBA 将运行指定当前数据库(accdb)作为数据源并根据以下代码运行 SQL: 'Set up Word Dim objWord As Object Set objWord = CreateObject("Word.Application") 'Make visible, open specified doc to merge With objWord .Visible = True .Documents.Open strDocName End With 'Set the data source path Dim docPath As String docPath = CurrentProject.Path & "\" & CurrentProject.Name 'Open the merge data source - simplified objWord.activedocument.mailmerge.opendatasource _ Name:=docPath, _ SQLStatement:=strSQL strDocName 和 strSQL 被传入并包含有效的功能性内容。 它成功打开单词,使其可见并打开要合并的模板。 但是,此时它会要求确认数据源,并显示可能的数据源列表。 单击“全部显示

2021-07-10 15:09:32    分类:技术分享    vba   ms-access   odbc   mailmerge

How to merge entirely different pages based on value of merge field

At my office we use documents with merge fields from Microsoft Word for a number of different functions. However, I can't find a way to merge entire pages based on the value of a merge field. For instance, there are different forms you have to use to notarize documents in different state. I want to set it up so that if the state chosen is MN, the document will generate the notary form for Minnesota, if the state chosen is NC, the document will generate the notary form for NC, etc. Is this possible?

2021-07-01 19:01:52    分类:问答    ms-word   mailmerge   word-field

Mail Merge (Excel to Word) using C#

I was wondering if anybody knew how to do a mail merge using an Excel file as a datasource, to fill in fields on a Word template? I wish to use the interop for Word if i could...but am having a few difficulties finding code for this. Does anybody have any syntax for this? Thank you in advance.

2021-06-29 07:22:49    分类:问答    c#   email   interop   ms-word   mailmerge