-
WSsolomod
AskWoody LoungerSorry guys – didn’t read the post from Hans properly… I read it as check it. So I’ve just cleared it and it works perfectly.
I’ve been living in France for the last five years so perhaps the the red wine has something to do with it.
Many thanks,
David
-
WSsolomod
AskWoody LoungerHello Hans,
Sorry to say it already is.
Many thanks,
David
-
WSsolomod
AskWoody LoungerWell, I am pleased. I retire in September to France to run a B&B and to restore the old cottage next door… I cannot often contribute but I have had so much help from the Forum over the last few years.
Glad to have been of help.
David
-
WSsolomod
AskWoody LoungerI use this macro on my forms – it unprotects the doc, finds the last table, copies it, adds a page and pastes the table on, then clears the table entries. I activate the macro from a command button on the first page.
Sub add_page()
Dim pass
Dim table_num As Integer
Dim i As Integerpass = “your password here”
i = ActiveDocument.Tables.count
table_num = i
ActiveDocument.Unprotect Password:=(pass)
With ActiveDocument.Tables(table_num)
.Select
End WithSelection.copy
Selection.EndKey Unit:=wdStory
Selection.InsertBreak Type:=wdPageBreak
Selection.Pastei = ActiveDocument.Tables.count
table_num = i
With ActiveDocument.Tables(table_num)
.Select
Selection.Fields.Update
End WithActiveDocument.Protect Password:=(pass), NoReset:=True, Type:=wdAllowOnlyFormFields
End Sub
-
WSsolomod
AskWoody LoungerYes!!!
Don’t apologise Hans – I salute you. I worried away all yesterday afternoon trying to make it work.
Many thanks – treat yourself to a coffee and a cake.
Regards,
David
-
WSsolomod
AskWoody LoungerPrinting okay now except… It prints the correct number of files, say 5 for a five-page document, but instead of printing page 1 in file 1, page 2 in file 2 etc it prints 5 files containg all the pages.
Think it’s time for coffee.
Regards,
David
-
WSsolomod
AskWoody LoungerHi Hans,
Still getting an error “Invalid print range” – code looks like this:
For i = 1 To page_num
svPdfName = “d:batcher” & “testing again ” & i & “.pdf”
System.PrivateProfileString(svPDFIni, “Acrobat PDFWriter”, “PDFFilename”) = svPdfName
ActiveDocument.PrintOut Background:=0, Range:=wdPrintRangeOfPages, outputFilename:=””, _
Item:=wdPrintDocumentContent, Copies:=1, Pages:=Chr(34) & i & Chr(34), PageType:=wdPrintAllPages, PrintToFile:=False, Collate:=FalseNext i
Many thanks,
David
-
WSsolomod
AskWoody LoungerHello Fred,
Sorry for delay in reply – just back from Provence. Very cold but sunny.
I ran the IsDate code as part of the email macro that was triggered by the “Email this Form” command button at the top of the form. I could never get SendKeys to work.
If you are not e-mailing the form I presume you are either printing it straight off and/or saving to the users harddrive so I would put a command button next to the last field. The button would either print or offer the save dialogue. You could run the validation macro from that.
You could also leave the last field as a field that does not require validation. That was my easy option (move the date field to the beginning of the form so that the user would tab out of it) but the other validation processes used field numbers and I could not face the thought of sorting all the numbers out again in the macro.
However I do not know of any way to validate a last field if the user just saves from the File drop-down. I think we need Kevin or Hans here!
Regards,
David
-
WSsolomod
AskWoody LoungerHello Kevin,
I was running the code off the command button but a Google search unearthed IsDate so I have used that and it works okay:
Dim test_date
test_date = ActiveDocument.FormFields(“disposal_date”).ResultIf Not IsDate(test_date) Then
MsgBox “Please enter a valid date”, vbCritical & vbOKOnly, “Error”
ActiveDocument.Bookmarks(“disposal_date”).Range.Fields(1).Result.Select
Exit Sub
End IfMany thanks,
David
-
WSsolomod
AskWoody LoungerHans,
Thanks for the tip. The button is located on the page; I dug around in Help and found out how to work a yes/no message box and used that instead.
All the best for the New Year,
David
-
WSsolomod
AskWoody LoungerHans,
Just found your macro when presented with a pile of files to combine…
Couldn’t make Andrew’s solution work and I used a tip from the MVP to amend yours to:
Sub CombineDocs()
Dim sPath As String
Dim doc As Document
Dim strFileName As StringWith Dialogs(wdDialogCopyFile)
If .Display 0 ThensPath = .Directory
Else
MsgBox “Dialog cancelled”
End If
End WithSet doc = Documents.Add
strFileName = Dir(sPath & “*.doc”)
Do While strFileName “”
Selection.InsertFile sPath & “” & strFileName
Selection.InsertBreak wdSectionBreakNextPage
strFileName = Dir
LoopEnd Sub
Worked fine for me – many thanks to you & andrew and maybe this amended version will be of use to someone.
David
-
WSsolomod
AskWoody LoungerThank you Hans – every one a winner.
David
-
WSsolomod
AskWoody LoungerYou need the full version of Adobe Acrobat.
David
-
WSsolomod
AskWoody LoungerCreate each pdf file seperately. In Acrobat open the first pdf then insert the remaining files one after the other. Save as one file.
David
-
WSsolomod
AskWoody LoungerOctober 17, 2002 at 4:56 am in reply to: Macro: print each sheet to pdf using sheet name as (Excel 97 sr-2 Win95) #624771Thanks to everybody for the help – I’ve just rattled through about 500 sheets producing 2-page pdf files in a couple of minutes.
David
![]() |
Patch reliability is unclear, but widespread attacks make patching prudent. Go ahead and patch, but watch out for potential problems. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
France : A law requiring messaging apps to implement a backdoor ..
by
Alex5723
1 hour, 6 minutes ago -
Dev runs Windows 11 ARM on an iPad Air M2
by
Alex5723
1 hour, 55 minutes ago -
MS-DEFCON 3: Cleanup time
by
Susan Bradley
1 hour ago -
KB5056686 (.NET v8.0.15) Delivered Twice in April 2025
by
lmacri
4 hours, 31 minutes ago -
How to enable Extended Security Maintenance on Ubuntu 20.04 LTS before it dies
by
Alex5723
13 hours, 9 minutes ago -
Windows 11 Insider Preview build 26200.5562 released to DEV
by
joep517
17 hours, 7 minutes ago -
Windows 11 Insider Preview build 26120.3872 (24H2) released to BETA
by
joep517
17 hours, 8 minutes ago -
Unable to eject external hard drives
by
Robertos42
16 hours, 45 minutes ago -
Saying goodbye to not-so-great technology
by
Susan Bradley
1 hour ago -
Tech I don’t miss, and some I do
by
Will Fastie
5 hours, 2 minutes ago -
Synology limits hard drives
by
Susan Bradley
1 day, 21 hours ago -
Links from Microsoft 365 and from WhatsApp not working
by
rog7
23 hours, 46 minutes ago -
WhatsApp Security Advisories CVE-2025-30401
by
Alex5723
2 days, 3 hours ago -
Upgrade Sequence
by
doneager
1 day, 20 hours ago -
Chrome extensions with 6 million installs have hidden tracking code
by
Nibbled To Death By Ducks
2 hours, 20 minutes ago -
Uninstall “New Outlook” before installing 2024 Home & Business?
by
Tex265
19 hours, 34 minutes ago -
The incredible shrinking desktop icons
by
Thumper
3 days ago -
Windows 11 Insider Preview Build 22635.520 (23H2) released to BETA
by
joep517
3 days, 2 hours ago -
Connecting hard drive on USB 3.2 freezes File Explorer & Disk Management
by
WSJMGatehouse
1 hour, 5 minutes ago -
Shellbag Analyser & Cleaner Update
by
Microfix
1 day, 11 hours ago -
CISA warns of increased breach risks following Oracle Cloud leak
by
Nibbled To Death By Ducks
3 days, 11 hours ago -
Outlook 2024 two sent from email addresses
by
Kathy Stevens
2 days, 15 hours ago -
Speeding up 11’s search
by
Susan Bradley
23 hours, 36 minutes ago -
HP Pavilion Will Not Wake Up After Being Idle for Longer Period
by
WSwalterwood44
1 day, 11 hours ago -
Make a Windows 11 Local Account Passwordless
by
Drcard:))
4 days, 1 hour ago -
Ubuntu 25.04 (Plucky Puffin)
by
Alex5723
4 days, 8 hours ago -
24H2 fixed??
by
CWBillow
3 days, 1 hour ago -
Uninstalr Updates
by
jv16
4 days, 14 hours ago -
Apple zero days for April
by
Susan Bradley
10 hours, 39 minutes ago -
CVE program gets last-minute funding from CISA – and maybe a new home
by
Nibbled To Death By Ducks
3 days, 11 hours ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.