Prev: code to "remove" dictionaries for Word 2010
Next: Cannot upgrade to Word 2007 from Word 2002 as word crashes when tr
From: Dax Arroway on 21 Apr 2010 20:43 HELP please! I had a template that worked pretty good but I wanted to add a spell check macro and a print macro to, which I did, and it works great but now, when I open documents that were created from the old template, the one without the macros, it somehow gets referenced to the new template, with the macros, and won't work. For example, I go to print it and the VB Debugger comes up. If I disable the macros and hit print, an error comes up saying that the macros are turned off and it won't print it. Yes, because the macro that it's trying to run references a button (that the macro hides) which isn't on the old forms. I'm not the expert of VB and my understanding of it is limited so if you'd be as English in your answers as you coud I sure would appreciate it. This only happens in documents that used the older version of that template. There weren't macros in them before, but now when I go to open them I'm asked if I want to run macros. It's weird! Please help. Does anyone have a clue as to what's going on and how to get it to knock it off?? Any help is greatly appreciated. Much thanks in advance!!! --Dax -- I would give my left hand to be ambidextrous!
From: Doug Robbins - Word MVP on 22 Apr 2010 00:49 You should change the name of the new template so that the old documents create a reference to the correct (old) template when they are opened. In the case of the documents, created from the new template. After changing the name of the new template, you will need to open the documents that were created from it and then attach the template with the new name to those documents so that the features in the new template are available to those documents. Alternatively, you will need to modify the code in the template so that it properly handles the errors that occur when and old document is opened. -- 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 "Dax Arroway" <DaxArroway(a)discussions.microsoft.com> wrote in message news:A9C1A231-D238-4705-A9DA-D02C4328AFE7(a)microsoft.com... > HELP please! I had a template that worked pretty good but I wanted to add > a > spell check macro and a print macro to, which I did, and it works great > but > now, when I open documents that were created from the old template, the > one > without the macros, it somehow gets referenced to the new template, with > the > macros, and won't work. For example, I go to print it and the VB Debugger > comes up. If I disable the macros and hit print, an error comes up saying > that the macros are turned off and it won't print it. Yes, because the > macro > that it's trying to run references a button (that the macro hides) which > isn't on the old forms. I'm not the expert of VB and my understanding of > it > is limited so if you'd be as English in your answers as you coud I sure > would > appreciate it. This only happens in documents that used the older version > of > that template. There weren't macros in them before, but now when I go to > open them I'm asked if I want to run macros. It's weird! Please help. > > Does anyone have a clue as to what's going on and how to get it to knock > it > off?? > Any help is greatly appreciated. Much thanks in advance!!! > --Dax > -- > I would give my left hand to be ambidextrous!
From: Dax Arroway on 22 Apr 2010 20:33 Again Doug, you're the man! Thank you so much. What I actually did was to create a copy of the modified file and gave it another name, then opened the older version of the modified file and deleted the macros. I left it there and that worked. I deleted it too and it still worked so we're good. There are instaces however, where I'd need to add some code that could handle this error. The template sits on the server and has a generic name, for example, Inatake.dot, which people access and have shortcuts to. This file every now and then gets updated. In ordr to not 'break' everyones links and shortcuts (which drives IT NUTS! hee hee), we keep the filename and replace it with the updated file. I'm wondering if you by chance might share some code which might get over the error message? The macro is a print macro which hides a macrobutton. So, documents without that macro button throw the errors. It's a runtime error and I don't know specifically what it says but here's the code for the "hiding the button". Sub FilePrint() With ActiveDocument .Bookmarks("AddProblemButton").Range.Font.Hidden = True Dialogs(wdDialogFilePrint).Show .Bookmarks("AddProblemButton").Range.Font.Hidden = False End With End Sub Sub FilePrintDefault() With ActiveDocument .Bookmarks("AddProblemButton").Range.Font.Hidden = True .PrintOut Background:=False .Bookmarks("AddProblemButton").Range.Font.Hidden = False End With End Sub Any help? -- I would give my left hand to be ambidextrous! "Doug Robbins - Word MVP" wrote: > You should change the name of the new template so that the old documents > create a reference to the correct (old) template when they are opened. In > the case of the documents, created from the new template. After changing > the name of the new template, you will need to open the documents that were > created from it and then attach the template with the new name to those > documents so that the features in the new template are available to those > documents. > > Alternatively, you will need to modify the code in the template so that it > properly handles the errors that occur when and old document is opened. > > -- > 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 > > "Dax Arroway" <DaxArroway(a)discussions.microsoft.com> wrote in message > news:A9C1A231-D238-4705-A9DA-D02C4328AFE7(a)microsoft.com... > > HELP please! I had a template that worked pretty good but I wanted to add > > a > > spell check macro and a print macro to, which I did, and it works great > > but > > now, when I open documents that were created from the old template, the > > one > > without the macros, it somehow gets referenced to the new template, with > > the > > macros, and won't work. For example, I go to print it and the VB Debugger > > comes up. If I disable the macros and hit print, an error comes up saying > > that the macros are turned off and it won't print it. Yes, because the > > macro > > that it's trying to run references a button (that the macro hides) which > > isn't on the old forms. I'm not the expert of VB and my understanding of > > it > > is limited so if you'd be as English in your answers as you coud I sure > > would > > appreciate it. This only happens in documents that used the older version > > of > > that template. There weren't macros in them before, but now when I go to > > open them I'm asked if I want to run macros. It's weird! Please help. > > > > Does anyone have a clue as to what's going on and how to get it to knock > > it > > off?? > > Any help is greatly appreciated. Much thanks in advance!!! > > --Dax > > -- > > I would give my left hand to be ambidextrous! >
From: Doug Robbins - Word MVP on 22 Apr 2010 20:51
You could add some code to the (an) autonew macro in the template that adds a document variable to each document that is created with the new template. Then in the code that is causing the error, you could include code to access the value assigned to that variable. If the variable does not exist (which it would not in documents created from the old template, you will get a Run-time error '5825' By using error trapping for that error, you can prevent the other error message from appearing. -- 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 "Dax Arroway" <DaxArroway(a)discussions.microsoft.com> wrote in message news:9587CF9E-BF2D-4A91-B2EB-8C03E6541F8C(a)microsoft.com... > Again Doug, you're the man! Thank you so much. What I actually did was > to > create a copy of the modified file and gave it another name, then opened > the > older version of the modified file and deleted the macros. I left it > there > and that worked. I deleted it too and it still worked so we're good. > There > are instaces however, where I'd need to add some code that could handle > this > error. The template sits on the server and has a generic name, for > example, > Inatake.dot, which people access and have shortcuts to. This file every > now > and then gets updated. In ordr to not 'break' everyones links and > shortcuts > (which drives IT NUTS! hee hee), we keep the filename and replace it with > the > updated file. > > I'm wondering if you by chance might share some code which might get over > the error message? The macro is a print macro which hides a macrobutton. > So, documents without that macro button throw the errors. It's a runtime > error and I don't know specifically what it says but here's the code for > the > "hiding the button". > > Sub FilePrint() > With ActiveDocument > .Bookmarks("AddProblemButton").Range.Font.Hidden = True > Dialogs(wdDialogFilePrint).Show > .Bookmarks("AddProblemButton").Range.Font.Hidden = False > End With > End Sub > > Sub FilePrintDefault() > With ActiveDocument > .Bookmarks("AddProblemButton").Range.Font.Hidden = True > .PrintOut Background:=False > .Bookmarks("AddProblemButton").Range.Font.Hidden = False > End With > End Sub > > Any help? > -- > I would give my left hand to be ambidextrous! > > > "Doug Robbins - Word MVP" wrote: > >> You should change the name of the new template so that the old documents >> create a reference to the correct (old) template when they are opened. >> In >> the case of the documents, created from the new template. After changing >> the name of the new template, you will need to open the documents that >> were >> created from it and then attach the template with the new name to those >> documents so that the features in the new template are available to those >> documents. >> >> Alternatively, you will need to modify the code in the template so that >> it >> properly handles the errors that occur when and old document is opened. >> >> -- >> 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 >> >> "Dax Arroway" <DaxArroway(a)discussions.microsoft.com> wrote in message >> news:A9C1A231-D238-4705-A9DA-D02C4328AFE7(a)microsoft.com... >> > HELP please! I had a template that worked pretty good but I wanted to >> > add >> > a >> > spell check macro and a print macro to, which I did, and it works great >> > but >> > now, when I open documents that were created from the old template, the >> > one >> > without the macros, it somehow gets referenced to the new template, >> > with >> > the >> > macros, and won't work. For example, I go to print it and the VB >> > Debugger >> > comes up. If I disable the macros and hit print, an error comes up >> > saying >> > that the macros are turned off and it won't print it. Yes, because the >> > macro >> > that it's trying to run references a button (that the macro hides) >> > which >> > isn't on the old forms. I'm not the expert of VB and my understanding >> > of >> > it >> > is limited so if you'd be as English in your answers as you coud I sure >> > would >> > appreciate it. This only happens in documents that used the older >> > version >> > of >> > that template. There weren't macros in them before, but now when I go >> > to >> > open them I'm asked if I want to run macros. It's weird! Please help. >> > >> > Does anyone have a clue as to what's going on and how to get it to >> > knock >> > it >> > off?? >> > Any help is greatly appreciated. Much thanks in advance!!! >> > --Dax >> > -- >> > I would give my left hand to be ambidextrous! >> |