?
Solved

Macro Created in 2003 upgaraded to 2007

Posted on 2009-07-14
10
Medium Priority
?
318 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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 1000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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 article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses
Course of the Month14 days, 13 hours left to enroll

770 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