Trouble with global Templates..

Hi,
 
I have some macro's that were written in 95 then converted to 97 then 2000, these are stored in my normal.dot file which is now hugh.

I have moved some of the macro's into another dot file, which I can add in as a global template.
 
But the the macro won't run and I can't edit it from the global template that i load

I get an Word Error 1055 - and it won't let me de-bug it ...

Hope thats clear...

Please help - it's driving me mad..
 
500pts

this is a copy of one of the macro - but none of them work even simply one..


Public Sub MAIN()
Dim x
Dim Name_$
Dim TestName
Dim AutoEntry$
Dim TestAutoEntry
Dim EntryName$
Dim Subject2$
Dim TestSubject2
Dim Answer

WordBasic.FileNew Template:="Letter", NewTemplate:=0

WordBasic.Call "Saving"

WordBasic.BeginDialog 604, 274, "Letter"
    WordBasic.TextBox 148, 8, 275, 34, "AddresseeBox", 1
    WordBasic.Text 23, 11, 85, 13, "Addressee:", "AddresseeTxt"

    WordBasic.TextBox 148, 50, 275, 78, "AddressBox", 1
    WordBasic.Text 23, 53, 67, 13, "Address:", "AddressTxt"

    WordBasic.TextBox 148, 136, 274, 18, "YourRefBox"
    WordBasic.Text 23, 137, 73, 13, "Your Ref:", "YourRefTxt"

    WordBasic.TextBox 148, 160, 275, 18, "OurRefBox"
    WordBasic.Text 23, 161, 65, 13, "Our Ref:", "OurRefTxt"

    WordBasic.TextBox 148, 186, 275, 18, "SalutationBox"
    WordBasic.Text 23, 187, 83, 13, "Salutation:", "SalTxt"

    WordBasic.Text 23, 212, 64, 13, "Subject:", "SubjectTxt"
    WordBasic.TextBox 148, 211, 275, 18, "SubjectBox"
    WordBasic.TextBox 147, 237, 275, 18, "SubjectBox2"

    WordBasic.OKButton 468, 10, 88, 21
    WordBasic.CancelButton 468, 34, 88, 21


WordBasic.EndDialog

Start:

Dim LetterDlg As Object: Set LetterDlg = WordBasic.CurValues.UserDialog

x = WordBasic.Dialog.UserDialog(LetterDlg)
If x = 0 Then
    GoTo Wrong
End If

WordBasic.EditBookmark Name:="NameAdd", SortBy:=0, GoTo:=1

Name_$ = LetterDlg.AddresseeBox
TestName = Len(Name_$)

If TestName > 0 Then
    WordBasic.Insert LetterDlg.AddresseeBox
    WordBasic.InsertPara
    GoTo Address
Else
    GoTo Address
End If

Address:
AutoEntry$ = LetterDlg.AddressBox
TestAutoEntry = Len(AutoEntry$)

If TestAutoEntry < 10 Then
    EntryName$ = LetterDlg.AddressBox
    WordBasic.WW7_EditAutoText Name:=EntryName$, Context:=0, InsertAs:=1, Insert:=1
Else
    WordBasic.Insert LetterDlg.AddressBox
End If

WordBasic.EditBookmark Name:="YourRef", SortBy:=0, GoTo:=1
WordBasic.Insert LetterDlg.YourRefbox

WordBasic.EditBookmark Name:="OurRef", SortBy:=0, GoTo:=1
WordBasic.Insert LetterDlg.Ourrefbox

WordBasic.EditBookmark Name:="Date", SortBy:=0, GoTo:=1
WordBasic.InsertDateTime DateTimePic:="dd MMMM yyyy", InsertAsField:=0

WordBasic.EditBookmark Name:="Salutation", SortBy:=0, GoTo:=1
WordBasic.Insert LetterDlg.SalutationBox

WordBasic.EditBookmark Name:="Subject", SortBy:=0, GoTo:=1

Subject2$ = LetterDlg.SubjectBox2
TestSubject2 = Len(Subject2$)

If TestSubject2 > 0 Then
   
Rem WordBasic.FormatParagraph LeftIndent:="0" + Chr(34), RightIndent:="0" + Chr(34), Before:="0 pt", After:="0 pt", LineSpacingRule:=0, LineSpacing:="", Alignment:=3, WidowControl:=1, KeepWithNext:=0, KeepTogether:=0, PageBreak:=0, NoLineNum:=0, DontHyphen:=0, Tab:="0", FirstIndent:="0" + Chr(34)

    WordBasic.Insert LetterDlg.SubjectBox
    WordBasic.EditBookmark Name:="Subject2", SortBy:=0, GoTo:=1
    WordBasic.Insert LetterDlg.SubjectBox2
    WordBasic.InsertPara

Rem WordBasic.FormatParagraph LeftIndent:="0" + Chr(34), RightIndent:="0" + Chr(34), Before:="0 pt", After:="12 pt", LineSpacingRule:=0, LineSpacing:="", Alignment:=3, WidowControl:=1, KeepWithNext:=0, KeepTogether:=0, PageBreak:=0, NoLineNum:=0, DontHyphen:=0, Tab:="0", FirstIndent:="0" + Chr(34)

Else
    WordBasic.Insert LetterDlg.SubjectBox
End If



WordBasic.EndOfDocument

GoTo Complete

Wrong:

Answer = WordBasic.MsgBox("Did you mean to cancel?", "Finish", 4 + 32)
If Answer = -1 Then
    WordBasic.FileClose (2)
    GoTo Complete
    Else
    GoTo Start
End If

Complete:


End Sub

Ian PriceIT ManagerAsked:
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.

GrahamSkanRetiredCommented:
The text of the message would be useful, but it probably can't find the template called "Letter"

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
anne17821Commented:
Also, these macros either came from a version before Word 97, or the person who originally wrote them only knew how to create macros in Word 95 or previous versions.  There are a lot of WordBasic commands in the code, which really hasn't been used since Word 95.  Even though there is support in later versions for WordBasic, it doesn't always work as expected.  The macros should really be redesigned using the VBA language to ensure compatibility with future versions and that it will actually work.  My understanding is that with each new version of Word, more and more of the WordBasic commands are not working as expected.

Anne P.
GrahamSkanRetiredCommented:
Yes, but who's going to convert them? I still have a Wordbasic manual for Word 6, so I would, for a ridiculously small fee - email is in my profile - but they would have to be supported and Ian has enough problems with the unmodifed macros.
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Ian PriceIT ManagerAuthor Commented:
Yep - Written in Word 6 I think - Well before my time...

We are phasing the system out this year anyway, but I still have to support them for the next 9 months or so...

The thing is once you load the macro's into any global template other then normal.dot they don't run but you can't even edit them which seems strange - I did at one point along time ago program in word basic so if I could it them I could figure out where they are falling over..at least

Ok guys what do you need more info - the actual message..??

When I try to get into the macro via VBA I get something like "**** locked" I need to check it..

I thought I could maybe call the macro from another template - but if they won't run to start with :-(

It's seems like it's got a restriction on it or something....

any suggestion's

Ian PriceIT ManagerAuthor Commented:
Morning,

This is what I have done so far..

The macro's run fine from normal.dot

Create a new global template to store some marco's
Copy said macro for normal.dot to new global template
then when I try to run the macro from global template we get this message...

Microsoft Word Err = 1055
The document name or path is not valid
Try one of the following:
* Check the Path to make sure it's typed correctly
* On the file menu, Click Open. Search for the file using this dialog box

The strange thing is that I can't edit the macro's once they are in global template ??

Any idea ?


Ian PriceIT ManagerAuthor Commented:
Crack it myself in the end.

Thanks guys

Ian
GrahamSkanRetiredCommented:
Sorry. Not been around for a few hours.
If you have made it a global template by putting it in the Word Startup folder, then you won't be able to edit the code
unless you open the template as a document.
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 Word

From novice to tech pro — start learning today.