Solved

Macro Created in 2003 upgaraded to 2007

Posted on 2009-07-14
10
311 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
  • 4
  • 4
  • 2
10 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
Comment Utility
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
Comment Utility
The macro is just saved as a .txt from what i can see.
0
 
LVL 59

Expert Comment

by:Chris Bottomley
Comment Utility
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
 
LVL 76

Expert Comment

by:GrahamSkan
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 59

Expert Comment

by:Chris Bottomley
Comment Utility
>>> 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
Comment Utility
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
Comment Utility
What is the error message?
0
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 500 total points
Comment Utility
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
Comment Utility
New question more important
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

There is a feature provided by MS Word that lets you create an Table of Contents for your Word document automatically. To use this feature for other documents there are two steps involved,   1.  Prepare your document for a table of contents (he…
It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now