Solved

Macro Created in 2003 upgaraded to 2007

Posted on 2009-07-14
10
315 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
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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

When creating Microsoft Word-based forms there may be a need to have a form field repeated throughout the whole document. For instance, with a company name, you may want this information repeated automatically throughout the document rather than man…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
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…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

856 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