Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Not sure I will be able to help, but...
Using VS2008 C# and Office 2007 Are you just controlling Word from C# using the object model, or are you writing a VSTO application? 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. 1. is this a .dot, a .dotx or a .dotm? (Or is it actually a .docx or .docm)? 2. are you opening it, or creating a new .doc/.docx/.docm based on it? 3. Does it have any VBA macros in it, or does the normal.dotm on your system have any, and if so, could it be trying to save something at that point? 4. this problem definitely occurs when you are /opening/ this file? 5. what is the actual data source, i.e. the thing the .odc references? Peter Jamieson http://tips.pjmsn.me.uk On 17/11/2009 01:09, JJ wrote: 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 |
#3
![]()
Posted to microsoft.public.word.mailmerge.fields
|
|||
|
|||
![]()
Hello Peter
My mistake was to save the template as wdFormatTemplate and not wdFormatXMLTemplate, so after using the wdFormatXMLTemplate type it works just fine. Kind regards Johnny E. Jensen "Peter Jamieson" wrote in message ... Not sure I will be able to help, but... Using VS2008 C# and Office 2007 Are you just controlling Word from C# using the object model, or are you writing a VSTO application? 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. 1. is this a .dot, a .dotx or a .dotm? (Or is it actually a .docx or .docm)? 2. are you opening it, or creating a new .doc/.docx/.docm based on it? 3. Does it have any VBA macros in it, or does the normal.dotm on your system have any, and if so, could it be trying to save something at that point? 4. this problem definitely occurs when you are /opening/ this file? 5. what is the actual data source, i.e. the thing the .odc references? Peter Jamieson http://tips.pjmsn.me.uk On 17/11/2009 01:09, JJ wrote: 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 |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
MailMerge - Working application. | Mailmerge | |||
Can I update a word-document based on an external template? | Microsoft Word Help | |||
Can I create MailMerge template without a Data Source? | Mailmerge | |||
External Insertion Point in a Template | Microsoft Word Help | |||
How do I create an application using forms/template/fields? | Microsoft Word Help |