Word 200 VBA Run Time Error 5154

I have written vba code behind word to open a template that has been partially completed from another template. Open a blank template form partially populate and save it with a site specific name. I then want to use the partially complete template form as a master that is opened completely populated and saved using a form button that updates the file name with the date and time and saves as a protected word doc(not template) ...all good and working fine Word 2003 SP3 .... upgrade the 2000 version I hear you say but the user is very happy with 2000 so that is not currently possible. Under 2000 I get the above error with debug highlighting the ActiveDocument SaveAs statement.

What is wrong with the code below ...ideas please!!!
Private Sub CommandButton1_Click()
' Macro recorded 6/11/2008 by Tony Nieroba NBA Computing
'
Dim dd, strClient, strMP As String
 
If ActiveDocument.ReadOnlyRecommended = True Then
   MsgBox "Document Already Saved - Save Button Blocked"
   GoTo endit
End If
 
 
dd = Format(Now, "yymmdd-hhmm")
  'MsgBox dd  ..
strClient = ActiveDocument.CustomDocumentProperties("Client").Value
  'MsgBox strClient
strMP = ActiveDocument.CustomDocumentProperties("MainPath").Value
  'MsgBox strMP
 
    ChangeFileOpenDirectory _
       strMP
    ActiveDocument.SaveAs FileName:=dd & "-" & strClient & "-SPRINKLER SYSTEMS.doc", FileFormat:=wdFormatDocument _
        , LockComments:=False, Password:="", AddToRecentFiles:=True, _
        WritePassword:="BAZZA", ReadOnlyRecommended:=True, EmbedTrueTypeFonts:=False, _
        SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
        False
 
    ActiveDocument.Close
endit:
End Sub

Open in new window

ynot8669OwnerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Joanne M. OrzechManager, Document Services CenterCommented:
I can't really run the code... but made some very minor modifications....

Private Sub CommandButton1_Click()
' Macro recorded 6/11/2008 by Tony Nieroba NBA Computing
'
Dim dd As Date
Dim strClient, strMP As String
 
If activedocument.ReadOnlyRecommended = True Then
   MsgBox "Document Already Saved - Save Button Blocked"
   GoTo endit
End If
 
 
dd = Format(Now, "yymmdd-hhmm")
  'MsgBox dd  ..
strClient = activedocument.CustomDocumentProperties("Client").Value
  'MsgBox strClient
strMP = activedocument.CustomDocumentProperties("MainPath").Value
  'MsgBox strMP
 
    ChangeFileOpenDirectory _
       strMP
    ActiveDocument.SaveAs FileName:=(dd & "-" & strClient & "-SPRINKLER SYSTEMS.doc"), FileFormat:=wdFormatDocument _
        , LockComments:=False, Password:="", AddToRecentFiles:=True, _
        WritePassword:="BAZZA", ReadOnlyRecommended:=True, EmbedTrueTypeFonts:=False, _
        SaveNativePictureFormat:=False, SaveFormsData:=False, SaveAsAOCELetter:= _
        False
 
    ActiveDocument.Close
endit:
End Sub

Open in new window

0
ynot8669OwnerAuthor Commented:
Yes it was as simple as adding the brackets to make it work ... much appreciated.
0
Joanne M. OrzechManager, Document Services CenterCommented:
Excellent.  Please accept the answer so this question may be closed.  Thank you.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ynot8669OwnerAuthor Commented:
I also found out that If I launch the word template from a link in Excel, I get a the template not a document as expected .... so I now have to find a way around that problem
0
Joanne M. OrzechManager, Document Services CenterCommented:
You should just be able to use the documents, add code:

Documents.Add Template:=Options.DefaultFilePath(wdUserTemplatesPath) & "\Document.DOT", newtemplate:=False

Open in new window

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.