Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 06-16-2010, 09:54 AM
Kimberly Kimberly is offline Macro to open template not working Windows 7 Macro to open template not working Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Posts: 517
Kimberly is on a distinguished road
Default

change .Destination = wdSendToNewDocument
to .Destination = 0
Reply With Quote
  #3  
Old 06-24-2010, 09:29 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

Thank you for your help. I am just getting back to this project. I have tried to change my macro to Destination = 0 and I get the same "Requested object not found"

If you are interested, I could do a GoToMeeting with you so that you can see what I am trying to do. Please let me know if you would like to do that.

Thank you.
Brandi
Reply With Quote
Reply

Thread Tools
Display Modes


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 01:10 PM.


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