Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.word.mailmerge.fields
JJ[_2_] JJ[_2_] is offline
external usenet poster
 
Posts: 2
Default Create MailMerge Template from external application

Hello NG

Using VS2008 C# and Office 2007

I want to create a template using my own application.
I have setup an OfficeDataConnection file (.odc) the i use for the mailmerge
datasource.

Everyting looks OK but when i open the template Word is giving me this
message:
Word has encountered a problem.
There is a problem saving the file.

Usually this is because the disk or floppy disk is too small for the file or
is full, RAM memory is low, or there is a permission problem with the drive
the file is being saved to.

If the amount of disk space for a paging file is low, save the file to
another drive. If the RAM memory is low, increase available RAM. If
permissions to the drive do not allow you to save to that drive, save the
file to another drive or request permissions from the administrator to save
files to the drive.

Note: This error can also occur if the computer is running a version of
antivirus software that is not compatible with the Microsoft Office system
or needs to be updated.

If I open the file as Template (you know - right click and click OPEN) I'll
get this.
Word experienced an error trying to open the file.
Try these suggestions. bla. bla.

Kind regards

Johnny E. Jensen

I do the following in my code.

Imports WD = Microsoft.Office.Interop.Word

Public Class WordWrapper

Public Sub CreateTemplate(ByVal Filename As String)

Dim app As WD.Application

app = New WD.Application

app.ScreenUpdating = True

app.Visible = True

Dim objDoc As WD.Document

objDoc = app.Documents.Add()

Dim objName As Object = "C:\Documents and Settings\JEJ.ANDEBY\My
Documents\My Data Sources\vwCustomers.odc"

objDoc.MailMerge.MainDocumentType =
Microsoft.Office.Interop.Word.WdMailMergeMainDocTy pe.wdFormLetters

objDoc.MailMerge.Destination =
Microsoft.Office.Interop.Word.WdMailMergeDestinati on.wdSendToNewDocument

objDoc.MailMerge.OpenDataSource(Name:=objName)

objDoc.SaveAs(FileName:=Filename,
FileFormat:=WD.WdSaveFormat.wdFormatTemplate)

End Sub

End Class


 
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MailMerge - Working application. Jon (UK) Mailmerge 3 October 8th 08 10:37 AM
Can I update a word-document based on an external template? Mikael Lindqvist Microsoft Word Help 2 May 27th 08 05:00 PM
Can I create MailMerge template without a Data Source? Tom Mailhot Mailmerge 2 November 26th 07 09:21 PM
External Insertion Point in a Template Lenny[_2_] Microsoft Word Help 2 April 19th 07 08:07 PM
How do I create an application using forms/template/fields? Word - Creating a Form with field, table Microsoft Word Help 2 April 23rd 06 04:26 AM


All times are GMT +1. The time now is 03:21 PM.

Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright 2004-2023 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"