Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 06-06-2023, 01:50 AM
mery mery is offline Saving as a pdf file based on certain parameters in the document Windows 10 Saving as a pdf file based on certain parameters in the document Office 2013
Novice
Saving as a pdf file based on certain parameters in the document
 
Join Date: Jun 2023
Posts: 2
mery is on a distinguished road
Default Saving as a pdf file based on certain parameters in the document

I need a little help. I tried to make a code that will make my future work much easier. The ultimate goal of the code I want to get is to save it as a pdf file based on certain data in this document.

Variable parameters are:
- Surname (Father's name) Name, which is in the 2nd paragraph.
- The name of the unit, which is in the 5th paragraph
- to the text after the word ID

My idea is that the file is saved for example "7. electoral unit MONICA (George) HENDERSON Sample 278B" which is what I got with this code.
However, when the name is changed in the fifth paragraph and if there are more or less words than 4 (currently the 7. electoral unit), then I cannot save it as a pdf file ("This is not valid filename" error).


In order to be able to save it, I have to change the code and enter the number of words in that paragraph, for example:

If it is stated in paragraph 5 "Main office" I have to change it

Code:
With rngLine5
         .End = .Start
         .MoveEnd wdWord, 2
         rngFilename = .Text
End With
How do I get the string from the fifth paragraph no matter how many words it has?

Thanks in advance...
Attached Files
File Type: docm sample_2.docm (21.5 KB, 3 views)
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to create document that will auto insert text based on parameters parisfranco Word 13 07-25-2017 03:21 PM
How to pass parameters to a .msg file? HereNow Outlook 0 11-05-2012 10:38 AM
Saving a contacts view parameters markjl Outlook 0 01-26-2011 04:19 AM
Update Document Template when Saving the Document File bjbercaw Word 3 11-16-2010 02:03 PM
Saving Word document creates a duplicate transparent file bbailey Word 0 12-05-2009 10:54 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:22 PM.


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