Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-11-2015, 09:31 AM
rdross51 rdross51 is offline How to share building block macros? Windows 7 32bit How to share building block macros? Office 2010 32bit
Advanced Beginner
How to share building block macros?
 
Join Date: Feb 2015
Location: Abu Dhabi
Posts: 45
rdross51 is on a distinguished road
Default How to share building block macros?

I'm developing a procedure template that contains building blocks and macros to use the building blocks to assign them to the ribbon. My problem is how can I share this with other writers. The template will be stored in the Word STARTUP directory by the macros I created use my name in the path. I tried substituting %USERNAME% in place of mine but that doesn't work. Any ideas?
Reply With Quote
  #2  
Old 03-11-2015, 02:18 PM
gmaxey gmaxey is online now How to share building block macros? Windows 7 32bit How to share building block macros? Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

If the building buildingblocks are stored in the same template as the template contain the code use:

ThisDocument.AttachtedTemplate....
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 03-11-2015, 05:49 PM
rdross51 rdross51 is offline How to share building block macros? Windows 7 32bit How to share building block macros? Office 2010 32bit
Advanced Beginner
How to share building block macros?
 
Join Date: Feb 2015
Location: Abu Dhabi
Posts: 45
rdross51 is on a distinguished road
Default

What's the difference between "ThisDocument" and "ActiveDocument"?

Here's a sample macro. Where would I put your code line?

Sub RevSummary()
'
' RevSummary Macro
'
'
Application.Templates( _
"C:\Users\robert.ross\Documents\Work\Nawah\Mas ter Templates\New\Nawah Procedure.dotm" _
).BuildingBlockEntries("Revision Summary").Insert Where:=Selection.Range, _
RichText:=True
End Sub
Reply With Quote
  #4  
Old 03-11-2015, 07:31 PM
Guessed's Avatar
Guessed Guessed is offline How to share building block macros? Windows 7 32bit How to share building block macros? Office 2010 32bit
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,977
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

ThisDocument is the document that contains the macro. ActiveDocument is the document open in active window.

If the macro is in the same template as the building block then you could use

Code:
Sub RevSummary()
  ThisDocument.AttachedTemplate.BuildingBlockEntries("Revision Summary").Insert _
      Where:=Selection.Range, RichText:=True
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 03-11-2015, 08:36 PM
gmaxey gmaxey is online now How to share building block macros? Windows 7 32bit How to share building block macros? Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

No it won't return the path. It thought you wanted to work with building blocks

Code:
Sub TT()
  MsgBox ThisDocument.Name
  MsgBox ThisDocument.FullName
  MsgBox ThisDocument.Path
  ThisDocument.AttachedTemplate.BuildingBlockEntries("Page X of Y").Insert Selection.Range
End Sub
ActiveDocument. That's the guy with his mug on the screen.
ThisDocument. Me. The guy running your code.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #6  
Old 03-12-2015, 05:38 AM
rdross51 rdross51 is offline How to share building block macros? Windows 7 32bit How to share building block macros? Office 2010 32bit
Advanced Beginner
How to share building block macros?
 
Join Date: Feb 2015
Location: Abu Dhabi
Posts: 45
rdross51 is on a distinguished road
Default

gmaxey - are you saying Guessed's solution will not work? I don't understand your MsgBox script. Seems like the other script whould work because it's the same as my macro without the path string.
Reply With Quote
  #7  
Old 03-12-2015, 06:41 AM
gmaxey gmaxey is online now How to share building block macros? Windows 7 32bit How to share building block macros? Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

I was answering the question that someone posted here and then apparently edited out. Will that return the path? No. But Msgbox ThisDoucment.Path will.

Have you ever heard the old saw "Give a man a fish and he eats for a day ... teach a man to fish and he eats for a lifetime?"

The message box script were intended as fishing lessons.

Guessed's solution is the same as I provided initially. ThisDocument.AttachedTemplate ...

If you would have tried either you would have seen that for yourself.
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/

Last edited by gmaxey; 03-12-2015 at 09:57 AM.
Reply With Quote
  #8  
Old 03-12-2015, 08:59 AM
rdross51 rdross51 is offline How to share building block macros? Windows 7 32bit How to share building block macros? Office 2010 32bit
Advanced Beginner
How to share building block macros?
 
Join Date: Feb 2015
Location: Abu Dhabi
Posts: 45
rdross51 is on a distinguished road
Default

Problem solved.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to share building block macros? Custom Building Block File Locations ptmuldoon Word 5 01-03-2015 08:45 AM
Using Building Block Gallery Content function on a form with restricted editing wes228 Word VBA 1 08-28-2014 08:14 AM
how to make building block content control determine bb to display elsewhere jamles12 Word VBA 5 11-16-2013 11:38 AM
Building blocks show correctly in dropdown, but wrong building block populates in doc wordgirl123 Word 0 10-03-2013 08:30 AM
How to share macros in Powerpoint 2007?? proshop PowerPoint 0 12-20-2009 07:29 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft