Solved

Macro Created in 2003 upgaraded to 2007

Posted on 2009-07-14
10
316 Views
Last Modified: 2012-05-07
We recently updated to office 2007 from office 03. We had a macro to add a text box as a title. The macro now only works in .dot files. It errors out in .doc. We need it to work on .dot and .doc files. Any help?
Sub topictag()
'
' topictag Macro
'
'
    ActiveDocument.AttachedTemplate.BuildingBlockEntries("tag").Insert Where:= _
        Selection.Range, RichText:=True
        
End Sub

Open in new window

0
Comment
Question by:directpointe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
10 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 24852318
Hello directpointe,

In 2007 macro enabled files have to be .docm.

If you want it to work in a .doc then ensure it is saved as type word 97 compatible .doc

Regards,
Chris
0
 
LVL 1

Author Comment

by:directpointe
ID: 24852734
The macro is just saved as a .txt from what i can see.
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 24852808
The macro is saved as part of the document.  IN the VBE it appears as text yes but the code is in a code module.  In 2007 files of type .doc are macro FREE, and must be saved as type .docm or as I said earlier as a word 97/2003 format as .doc.  Th eimportant point though is teh native word 2007 .doc file will not have any macros in it.

If the macro is saved elsewhere then that is a different matter so where do you run the code from?

Chris
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 76

Expert Comment

by:GrahamSkan
ID: 24854279
Sorry,

That macro couldn't have worked in Word 2003. The template object did not have

   BuildingBlockEntries  

as a property or a method.

0
 
LVL 1

Author Comment

by:directpointe
ID: 24854418
the document is saved as a 2003 format .doc- not anything fancy from 07(docx or docm). Would the import of the macro from 03 to .txt to office 07 macro cause this?
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 24856498
>>> Would the import of the macro from 03 to .txt to office 07 macro cause this?

POtentially yes

1.IMport of document text then yes the macro is wiped out, (ignored as such)
2. Import of the macro text and posting into a word 2007 document code module then unless the file is saved as 2003/97 compatible or .docm then the macros will again be non existant.

WHat happens in more detail during the cope?

Chris
0
 
LVL 1

Author Comment

by:directpointe
ID: 24898124
Ok so i got more information. They are just using the dev toolbar to create the macro step by step. On a few machines this has worked fine. Others it gives the error message. I don't understand how it would work in a template file (.dot) and not in the .doc file. Unless they create macro's differently?
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 24898228
What is the error message?
0
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 500 total points
ID: 25429034
directpointe

So far everything I understand you to say hinges on the fact that you need the macro enabled option in 2007 of saving as either .docm or 2003 .doc.

In regard to the error mesage then as Graham asked some info on the message would potentially help understanding of the issue.

Chris
0
 
LVL 1

Author Closing Comment

by:directpointe
ID: 31603375
New question more important
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question