Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-16-2010, 06:02 AM
Brandi Brandi is offline Macro to open template not working Windows XP Macro to open template not working Office 2003
Novice
Macro to open template not working
 
Join Date: Jun 2010
Posts: 13
Brandi is on a distinguished road
Default Macro to open template not working

I have recorded a macro to create a new document based on a template. When I use my template without the macro it opens a new document as expected and is able to use my data source.



When I use the macro to open a new document based on my template, I get the following error:
"requested object is not found" and it highlights
.Destination = wdSendToNewDocument

See complete macro below.

Sub Petition()
'
' Petition Macro
' Macro recorded 6/16/2010
'
Documents.Add Template:= _
"C:\Bergemann\Forfeiture\WordMailMerge\Petition.do t", NewTemplate:=False, _
DocumentType:=0
With ActiveDocument.MailMerge
.Destination = wdSendToNewDocument
.SuppressBlankLines = True
With .DataSource
.FirstRecord = wdDefaultFirstRecord
.LastRecord = wdDefaultLastRecord
End With
.Execute Pause:=False
End With
ActiveDocument.SaveAs FileName:="Petition.doc", FileFormat:= _
wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
SaveAsAOCELetter:=False
End Sub


Thank you.
Brandi
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to determine attached template zippyaus Word VBA 0 03-02-2010 02:05 AM
Template "File In Use" when opening 2 documents based on the same template wendt Word 5 12-15-2009 12:37 AM
Word field stops working on template launch anakeimai Word 0 09-10-2009 08:49 AM
Word 2000 Macro not working properly brianlb Word VBA 1 07-01-2009 07:04 AM
Word attachment on an E-mail-macro to open attachment & nablady Outlook 0 11-28-2006 03:00 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:52 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft