Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-27-2019, 01:55 PM
vba vba is offline Is This Possible Windows 10 Is This Possible Office 2013
Novice
Is This Possible
 
Join Date: Sep 2019
Posts: 3
vba is on a distinguished road
Default Is This Possible


Backstory:

I work for a learning management systems company. One of our clients use Microsoft Word to build and maintain their HTML training content.

Recently they have requested we implement a special "tagging" feature, which will substitute potions of content within their HTML documents depending on what department or position an employee is in.

We accomplish this by using a custom HTML element that wraps around an iframe and for the most part it works well. The problem is, when they go back to modify these documents in word they cannot see these custom elements and they are being unintentionally removed. If not unintentionally deleted, they do stay in the document after re-saving as web page filtered.



The Question:

Is it possible to create a VBA macro that can identify html elements in word? I haven't been able to find any information online. Ideally i'd like to create a macro that will apply styles to these elements (such as a red background, some height, and a border) when they first open the document then one to remove those once they are finished editing.

Thanks for reading!
Reply With Quote
  #2  
Old 09-28-2019, 08:32 PM
Guessed's Avatar
Guessed Guessed is offline Is This Possible Windows 10 Is This Possible Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
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

You haven't explained the special tagging feature so I'm not sure what you are doing but it sounds like you should investigate content controls. You can lock them so they can't be deleted accidentally. CCs are easy to work with as 'tagged elements' in a document so vba can interact with them.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #3  
Old 09-30-2019, 01:25 PM
vba vba is offline Is This Possible Windows 10 Is This Possible Office 2013
Novice
Is This Possible
 
Join Date: Sep 2019
Posts: 3
vba is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
You haven't explained the special tagging feature so I'm not sure what you are doing but it sounds like you should investigate content controls. You can lock them so they can't be deleted accidentally. CCs are easy to work with as 'tagged elements' in a document so vba can interact with them.

Content controls sound like they would work well but unfortunately, they do not seem to persist after saving the document as a web page. Once the document is re-opened the controls no longer exist.
Reply With Quote
  #4  
Old 10-01-2019, 12:04 AM
Guessed's Avatar
Guessed Guessed is offline Is This Possible Windows 10 Is This Possible Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
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

How is the content tagged? The usual 'editing workflow' should be to work with native Word documents and export to html for each release. Editing the html files as the source for a revision loses a lot of the control and tagging.

We need to know what tagging is being used that survives saving/opening as html. If that content is there then a macro can use it.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #5  
Old 10-01-2019, 08:17 AM
vba vba is offline Is This Possible Windows 10 Is This Possible Office 2013
Novice
Is This Possible
 
Join Date: Sep 2019
Posts: 3
vba is on a distinguished road
Default

Quote:
Originally Posted by Guessed View Post
How is the content tagged? The usual 'editing workflow' should be to work with native Word documents and export to html for each release. Editing the html files as the source for a revision loses a lot of the control and tagging.

We need to know what tagging is being used that survives saving/opening as html. If that content is there then a macro can use it.

Keeping a native copy of the word documents would be ideal but unfortunately we're working with 20,000-30,000 already exported pages so that ship has sailed.

Our "tagging" not a word feature, we use an HTML element that's been added to the document outside of word. It looks something like this:

Code:
<taggedcontent path="/Content/WHIMIS" position="employee"></taggedcontent>
then we have a script in our LMS that will inject the requested content via an ajax request. Since it's an empty element no content appears without our script present, thus it's easy to be deleted from within word.

Thanks a lot for your help thus far by the way!
Reply With Quote
Reply

Thread Tools
Display Modes


Other Forums: Access Forums

All times are GMT -7. The time now is 04:43 PM.


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