![]() |
#1
|
|||
|
|||
![]()
Our Company just upgraded to Office 2013, and as I continue to my learning of VBA and so on, I’m trying to learn the best way to achieve the following.
Currently, I have created a Word Template file that the end user will create a new document from. Within that template is approximately 70+ OLE links to an Excel File to pull various tables and charts. And I have a separate macro (thanks Macropod!) in the Word Startup folder to let the user change the OLE links to a different excel (Workpaper) file. And it all works fairly well so far. Now, my ‘problem’ is that if the end user deletes a table or chart, they really don’t know how to add that chart back to the document. So my thought was to have some kind of drop down menu/list of the all of the charts where the user could insert the chart back into the document. So my first thoughts are: 1. The ability to reference the Excel file in a Custom Field, and have a macro where the user could change that Field Code value to the current excel workpaper file. 2. Then have a listing of all tables and charts that would look at that file and be able to re-insert them into document where needed. I think maybe each chart would also need a separate custom field code, and could a) reference the field code made in item 1 above to get the current file path/name, and b) also reference the appropriate cells/named ranges for the table or chart? I’ve just started reading on the use of Field Codes, Autotext, and Building blocks, and think the use of these may be a start in the right direction. But I’m not sure which of these is the best approach or if I’m even going in the right direction. Any help/push in the right direction would be great. I can then hopefully begin reading some more and begin work on VBA code, etc as I learn. Thanks Paul |
#2
|
|||
|
|||
![]()
in doing some more reading, I think what I'm trying to do is possible. I found these posts/discussions here and am going to start trying to play and learn.
I think it involves a combination of setting up custom fields with VBA and using the GetProperty and SetProperty functions? http://stackoverflow.com/questions/4...der-to-ms-word http://www.cpearson.com/excel/docprop.aspx |
#3
|
|||
|
|||
![]()
Greg Maxey is Awesome!!!
I think using Building Blocks is the Way to go. If I assign all my charts and tables a custom Building Block, the user can then reinsert them. http://gregmaxey.com/word_tip_pages/..._autotext.html Now, I just need to learn how to modify a building block to change its excel file source, and then learn to create a menu, dropdown etc of the custom blocks for the user to use to insert them where needed. |
#4
|
|||
|
|||
![]()
|
#5
|
|||
|
|||
![]()
Thanks Charles.
It may be time to move this topic over to the Word VBA section or I can start a new post there as well. I'm learning and experimenting, and am trying to figure out how can I modify both fieldcodes and Building Blocks in VBA to accept variables and/or other field codes. Example would be. I have Building block that is an OLE link to a table in Excel. That building block value in debug looks something like this: Code:
* LINK Excel.SheetMacroEnabled.12 "C:\\NewPath\NewFile.xlsm" "Receivable Charts!Charts_Receivable_ARTrendPrior" \a \p *** But I want the user to be able to replace the filepath/filename of the building block, and hopefully without being asked to resave the building blocks template file. My thought was to use a FieldCode(s) of the filepath and filename in the Building Block. And then a macro to update those 2 field codes, and the building blocks would then not need to changed. But I'm not sure if that is the best approach. I'm also struggling similarly to replace a fieldcode value with a new value from a variable. I'm gonna keep playing. But greatly for any help, and I'll post some sample code shortly. EDIT: Think I got the updating/modifying of Field Code with a variable figured out. Now, I need to research how to combined field codes together in side of each other. |
#6
|
|||
|
|||
![]()
See also Greg Maxey's Build & Deploy Custom Buildign Block Galleries.
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
TommyVincent | Outlook | 2 | 08-01-2014 08:20 AM |
![]() |
jafrapatty | Word | 2 | 05-09-2014 04:30 AM |
![]() |
gotmatt | Word | 2 | 06-29-2011 06:05 PM |
![]() |
jafrapatty | Office | 3 | 01-30-2011 01:11 AM |
AutoText Updates | Ludovico | Word | 0 | 07-11-2010 06:10 AM |