Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #16  
Old 07-08-2020, 08:54 AM
Steve2081 Steve2081 is offline Checkbox code Windows 7 64bit Checkbox code Office 2016
Advanced Beginner
Checkbox code
 
Join Date: Apr 2020
Posts: 39
Steve2081 is on a distinguished road
Default


Hi Andrew.
the word doc was working really well, I've added lots of exercises into the dynamic gallery via the quick parts method. I've encountered a problem when colleagues are using the doc. The document(docm) is stored on a shared drive.
when I access the doc, the BBs are there and the Email button on the ribbon works fine. When others access it the docm the BBs arent there but the email button works. If I change the docm to a dotm the reverse happens I've set the macro security to the same as mine. Can you help?
Reply With Quote
  #17  
Old 07-08-2020, 05:01 PM
Guessed's Avatar
Guessed Guessed is offline Checkbox code Windows 10 Checkbox code Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,732
Guessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of light
Default

Steve

BBs are stored in a template, not a document. So if you are making the docm available to the users, they also need access to the template which contains the BBs.

When the docm is opened, Word looks to see what template is attached to it. The attached template can be a specific template or Normal.dotm. Assuming you put all the BBs into a template and have attached that template to the docm, you should now put that template in the same folder as the docm file. Word looks in 4 locations for the attached template and the same folder as the docm is one of those locations.

In my opinion, it would be better to make a dotm file available to your users. This avoids the need for a second file in order to work.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #18  
Old 07-08-2020, 11:43 PM
Steve2081 Steve2081 is offline Checkbox code Windows 7 64bit Checkbox code Office 2016
Advanced Beginner
Checkbox code
 
Join Date: Apr 2020
Posts: 39
Steve2081 is on a distinguished road
Default

Hi Andrew
I've tried putting the template into the shared folder for people to access and they can get the BBs. However a code error occurs when the Email button is used. I've attached a screen shot of the error alongside a DOTM/DOCM version of the exercise template. Please can you help with the error?
Reply With Quote
  #19  
Old 07-08-2020, 11:49 PM
Steve2081 Steve2081 is offline Checkbox code Windows 7 64bit Checkbox code Office 2016
Advanced Beginner
Checkbox code
 
Join Date: Apr 2020
Posts: 39
Steve2081 is on a distinguished road
Default

Hi Andrew
I've tried putting the template into the shared folder for people to access and they can get the BBs. However a code error occurs when the Email button is used. I've attached a screen shot of the error. Please can you help with the error?
Attached Images
File Type: jpg code.jpg (49.3 KB, 11 views)
Reply With Quote
  #20  
Old 07-09-2020, 12:35 AM
Guessed's Avatar
Guessed Guessed is offline Checkbox code Windows 10 Checkbox code Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,732
Guessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of light
Default

OK, this line is probably erroring because it doesn't have a document path or the named file doesn't exist in that document path.

Why might a document not have a document path? If you double click on a template (dotx or dotm file), Word creates a brand new document which hasn't yet been saved - and therefore it doesn't have a folder path.

If you hover over ThisDocument.Path, does it show a valid path? If it does, look in that folder to verify the named file exists there (the Message Cover file)

Generally, I would recommend that you put the two templates in a folder that the users can access - you don't need a docm file if you put the code inside a dotm template. If they create a new docx file by double clicking the dotm file then when they save the document, the template path will be saved as the 'Attached Template' so they will still have access to the macros and the Building Blocks. Your code could then make use of the template location for the email cover by either using ThisDocument.Path (the file the code is running from) or ActiveDocument.AttachedTemplate.Path (the path where the attached template is saved).
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #21  
Old 07-09-2020, 12:37 AM
gmayor's Avatar
gmayor gmayor is offline Checkbox code Windows 10 Checkbox code Office 2016
Expert
 
Join Date: Aug 2014
Posts: 3,219
gmayor is a glorious beacon of lightgmayor is a glorious beacon of lightgmayor is a glorious beacon of lightgmayor is a glorious beacon of lightgmayor is a glorious beacon of lightgmayor is a glorious beacon of light
Default

Did you also put the message document in the same shared folder?
The code flagged is looking for that document in the same folder as the template with the code.
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
  #22  
Old 07-09-2020, 01:01 AM
Steve2081 Steve2081 is offline Checkbox code Windows 7 64bit Checkbox code Office 2016
Advanced Beginner
Checkbox code
 
Join Date: Apr 2020
Posts: 39
Steve2081 is on a distinguished road
Default

Hi Greg.
Thank you for your reply. Yes the message document is in the same folder as the template.
Reply With Quote
  #23  
Old 07-09-2020, 02:16 AM
Steve2081 Steve2081 is offline Checkbox code Windows 7 64bit Checkbox code Office 2016
Advanced Beginner
Checkbox code
 
Join Date: Apr 2020
Posts: 39
Steve2081 is on a distinguished road
Default

Hi Andrew
If I hover over the ThisDocument.Path it displays a path but I can't see it all. There is a Message Cover file in the same folder as the template.


I've also experienced a code error on this line ( ActiveDocument.ExportAsFixedFormat OutputFileName:=strFileName, ExportFormat:=wdExportFormatPDF) when trying to activate the email button via the template.
Reply With Quote
  #24  
Old 07-09-2020, 03:38 PM
Guessed's Avatar
Guessed Guessed is offline Checkbox code Windows 10 Checkbox code Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,732
Guessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of light
Default

If you can't see a path then ThisDocument hasn't been saved yet.

With the other line, what is the value of strFileName at the time of the error?

You can debug these errors more easily if you watch values of the variables involved.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #25  
Old 07-09-2020, 11:06 PM
Steve2081 Steve2081 is offline Checkbox code Windows 7 64bit Checkbox code Office 2016
Advanced Beginner
Checkbox code
 
Join Date: Apr 2020
Posts: 39
Steve2081 is on a distinguished road
Default

Thanks again, so far I've managed to get it working fine now. It was the issue with path as you suggested.
Reply With Quote
  #26  
Old 07-23-2020, 07:11 AM
Steve2081 Steve2081 is offline Checkbox code Windows 7 64bit Checkbox code Office 2016
Advanced Beginner
Checkbox code
 
Join Date: Apr 2020
Posts: 39
Steve2081 is on a distinguished road
Default

Hi Andrew
I've attached a screen shot of a page from the Exercise Index, it has 3 quick part saved to it. So the therapist can click on it a chose the exercise. This works great.
What I was wondering was, once an exercise is chosen and the quick part is imported into the doc, is there a way of ensuring the next quick part (one directly below) moves under down the page below the nearly imported exercise?
Attached Images
File Type: jpg Untitled.jpg (54.1 KB, 6 views)

Last edited by Steve2081; 07-23-2020 at 07:12 AM. Reason: missed attachment
Reply With Quote
  #27  
Old 07-23-2020, 04:25 PM
Guessed's Avatar
Guessed Guessed is offline Checkbox code Windows 10 Checkbox code Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,732
Guessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of light
Default

Steve

I'm going to have guess what this means "moves under down the page below the nearly imported exercise?" I'll assume that the content is inline and adding something at position 1 pushes the other two down the page and that you are asking for an automatic page break to appear ONLY if there is non-empty content above it.

I would include pagination info into the styling of all exercises so that the pagination is automatic. Each exercise should contain only paragraphs which have their "Keep with Next" setting turned on. Importantly, the paragraph which contains the CC itself should NOT have this setting turned on which will allows the exercises to start on a new page if they can't fully squeeze onto the preceding page.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
  #28  
Old 07-24-2020, 01:34 PM
Steve2081 Steve2081 is offline Checkbox code Windows 7 64bit Checkbox code Office 2016
Advanced Beginner
Checkbox code
 
Join Date: Apr 2020
Posts: 39
Steve2081 is on a distinguished road
Default

Hi Andrew
you guessed right.

thanks I'll give it a go after the weekend.
Reply With Quote
  #29  
Old 07-24-2020, 09:22 PM
Guessed's Avatar
Guessed Guessed is offline Checkbox code Windows 10 Checkbox code Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 1,732
Guessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of lightGuessed is a glorious beacon of light
Default

if you used styles correctly in all the entries you saved then you just need to update the style definitions for the styles you used.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Checkbox code Check Boxes Not Displayed via MailMerge CheckBox Insertion code JennEx Mail Merge 2 05-28-2019 05:55 PM
Checkbox code One Content Control Checkbox checks another Content Control Checkbox DEsh Word VBA 2 10-06-2017 08:23 PM
Copy ActiveX-Checkbox with code DanielM125 Word VBA 0 06-04-2015 12:49 AM
Checkbox code Uncheck Checkbox Code not working if document protected bandrist Word VBA 2 08-14-2013 09:02 AM
Excel ->VB code for Checkbox (control toolbox) kirkstyle Excel 0 08-16-2006 04:17 PM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 12:45 PM.


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