Advertisement

There's no such thing as a stupid question, but they're the easiest to answer.
Login
Search

Advertisement

Business Applications Business Applications
Search Search
Search for:
Tech Support Guy > > >

Teacher needs help with Macros Word 2007


(!)

meccagza's Avatar
meccagza meccagza is offline
Computer Specs
Junior Member with 2 posts.
THREAD STARTER
 
Join Date: Nov 2011
Experience: Intermediate
22-Nov-2011, 01:43 AM #1
Angry Teacher needs help with Macros Word 2007
I have been having problems with more than half my machines, some are laptops and some are networked desktop computers. I am having my students record macros for basic formatting. Half the tasks we try give us errors or simply don't complete (For example, if I center all the text, change the background color and add a page border, the background color simply won't change even though I can see it in the code). I have had a particular problem with inserting the student name into the header of the document. They need to be able to do this in particular because they are taking Cambridge Exams and might be asked to do it. The first line is the line of code that is highlighted and gives us errors:

ActiveDocument.AttachedTemplate.BuildingBlockEntries(" Blank").Insert_Where:=Selection.Range, RichText:=True
Selection.Delete Unit:=wdCharacter, Count:=1
Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
Welection.TypeText Text:="Student Name "

Please help !
WendyM's Avatar
Trusted Advisor with 3,995 posts.
 
Join Date: Jun 2003
Location: Northern California
23-Nov-2011, 12:29 PM #2
Hi meccagza,
Are you getting a runtime error message? If so, what does it say? And are you recording this macro or writing it from scratch?
meccagza's Avatar
meccagza meccagza is offline
Computer Specs
Junior Member with 2 posts.
THREAD STARTER
 
Join Date: Nov 2011
Experience: Intermediate
24-Nov-2011, 03:50 AM #3
Question Clarification
We are recording the macro, I am not a programmer so I am not be able to write it from scratch. Sometimes we get a runtime error, and sometimes it just doesn't show up (the name in the header). When I go into debug the first line of code is highlighted. If you have any ideas or suggetions to make things work better, that would be great, we are just trying to use macros at this point for very simple page formatting and name insertion.
Keebellah's Avatar
Keebellah   (Hans) Keebellah is offline Keebellah is a Trusted Advisor with special permissions. Keebellah has a Profile Picture
Computer Specs
Trusted Advisor with 5,268 posts.
 
Join Date: Mar 2008
Location: Oegstgeest, The Netherlands
Experience: Advanced
24-Nov-2011, 07:12 AM #4
I think posting a sample with the macro's will offer more information so that one of us can look at it.
Your information does not tell us anything.
WendyM's Avatar
Trusted Advisor with 3,995 posts.
 
Join Date: Jun 2003
Location: Northern California
28-Nov-2011, 01:29 PM #5
The problem is likely with the AttachedTemplate.BuildingBlockEntries. When you're recording, Word knows where to get those Building Blocks. But when you try to run it in an document, Word doesn't understand what the "attached template" is, so you have to tell it how to get to the Building Blocks. You can add several lines of code to try to get the macro working, but since you're not comfortable with modifying the code I think it would be simpler to create the Building Block and save it as a header that the students could just insert as needed. Does it have to be a macro?
As Seen On

BBC, Reader's Digest, PC Magazine, Today Show, Money Magazine
WELCOME TO TECH SUPPORT GUY!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.


Tags
macros, microsoft, word 2007

(clock)
THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


WELCOME
You Are Using: Server ID
Trusted Website Back to the Top ↑