From: Jonathan on 28 Apr 2010 22:17 Hi using Word 2003. Maybe there is a better way to do this. Please let me know how to do it if there is. I have set up a template that has an Excel workbook as its data source. I would now like to automate merging data to a new document. With wdApp Set wordTemplate = .Documents.Open(letterTemplate) wordTemplate.mailmerge.Execute (True) Set wordDocument = .ActiveDocument ... End With The line where the template is opened triggers the following message. 'Opening this document will run the following SQL command... Data from your database will be placed in the document. Do you want to continue?' How do I set up my template so that the data is updated without the need for this message? Many thanks, Jonathan
From: Doug Robbins - Word MVP on 28 Apr 2010 22:50 See the following Knowledge Base article: "Opening This Will Run the Following SQL Command" Message When You Open a Word Document - 825765 at: http://support.microsoft.com?kbid=825765 -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Jonathan" <Jonathan(a)discussions.microsoft.com> wrote in message news:19926BA6-BAD1-450C-9557-DDDDFB9C04D9(a)microsoft.com... > Hi using Word 2003. > > Maybe there is a better way to do this. Please let me know how to do it if > there is. > > I have set up a template that has an Excel workbook as its data source. I > would now like to automate merging data to a new document. > > With wdApp > Set wordTemplate = .Documents.Open(letterTemplate) > wordTemplate.mailmerge.Execute (True) > Set wordDocument = .ActiveDocument > ... > End With > > The line where the template is opened triggers the following message. > 'Opening this document will run the following SQL command... Data from > your > database will be placed in the document. Do you want to continue?' > > How do I set up my template so that the data is updated without the need > for > this message? > > Many thanks, > Jonathan
From: Jonathan on 29 Apr 2010 00:11 Thanks Doug. Looks like I need to reattach the data source each time. Jonathan "Doug Robbins - Word MVP" wrote: > See the following Knowledge Base article: > > "Opening This Will Run the Following SQL Command" Message When You Open a > Word Document - 825765 at: > > http://support.microsoft.com?kbid=825765 > > > -- > Hope this helps. > > Please reply to the newsgroup unless you wish to avail yourself of my > services on a paid consulting basis. > > Doug Robbins - Word MVP, originally posted via msnews.microsoft.com > > "Jonathan" <Jonathan(a)discussions.microsoft.com> wrote in message > news:19926BA6-BAD1-450C-9557-DDDDFB9C04D9(a)microsoft.com... > > Hi using Word 2003. > > > > Maybe there is a better way to do this. Please let me know how to do it if > > there is. > > > > I have set up a template that has an Excel workbook as its data source. I > > would now like to automate merging data to a new document. > > > > With wdApp > > Set wordTemplate = .Documents.Open(letterTemplate) > > wordTemplate.mailmerge.Execute (True) > > Set wordDocument = .ActiveDocument > > ... > > End With > > > > The line where the template is opened triggers the following message. > > 'Opening this document will run the following SQL command... Data from > > your > > database will be placed in the document. Do you want to continue?' > > > > How do I set up my template so that the data is updated without the need > > for > > this message? > > > > Many thanks, > > Jonathan >
From: Doug Robbins - Word MVP on 29 Apr 2010 03:09 Yes, if you do not want to implement the work around, that is what you will have to do. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Jonathan" <Jonathan(a)discussions.microsoft.com> wrote in message news:6DC93D09-F738-4D0E-8BAB-27E3F4D35782(a)microsoft.com... > Thanks Doug. Looks like I need to reattach the data source each time. > > Jonathan > > "Doug Robbins - Word MVP" wrote: > >> See the following Knowledge Base article: >> >> "Opening This Will Run the Following SQL Command" Message When You Open a >> Word Document - 825765 at: >> >> http://support.microsoft.com?kbid=825765 >> >> >> -- >> Hope this helps. >> >> Please reply to the newsgroup unless you wish to avail yourself of my >> services on a paid consulting basis. >> >> Doug Robbins - Word MVP, originally posted via msnews.microsoft.com >> >> "Jonathan" <Jonathan(a)discussions.microsoft.com> wrote in message >> news:19926BA6-BAD1-450C-9557-DDDDFB9C04D9(a)microsoft.com... >> > Hi using Word 2003. >> > >> > Maybe there is a better way to do this. Please let me know how to do it >> > if >> > there is. >> > >> > I have set up a template that has an Excel workbook as its data source. >> > I >> > would now like to automate merging data to a new document. >> > >> > With wdApp >> > Set wordTemplate = .Documents.Open(letterTemplate) >> > wordTemplate.mailmerge.Execute (True) >> > Set wordDocument = .ActiveDocument >> > ... >> > End With >> > >> > The line where the template is opened triggers the following message. >> > 'Opening this document will run the following SQL command... Data from >> > your >> > database will be placed in the document. Do you want to continue?' >> > >> > How do I set up my template so that the data is updated without the >> > need >> > for >> > this message? >> > >> > Many thanks, >> > Jonathan >>
|
Pages: 1 Prev: Digitally Sign a Code Module Next: Word TextBox nightmare |