Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-07-2022, 09:14 AM
tripeptide tripeptide is offline Looking for a randomization macro in Word 365 Windows 10 Looking for a randomization macro in Word 365 Office 2019
Novice
Looking for a randomization macro in Word 365
 
Join Date: Jan 2022
Posts: 1
tripeptide is on a distinguished road
Default Looking for a randomization macro in Word 365

Not sure if this is the best use of this forum, but: Good morning all. I am looking for someone to create a custom macro for me. Background: I use notecards to study and have several different tests. I have a template to make notecards in word (see attached example please), like, thousands of them in different documents.


They all follow the same general layout, with an even page as the front and the next odd page as the back.




Is there someone that can come up with a macro to randomize the pages such that the even pages are randomized and the next odd page always follows?

Thanks!


-Tripeptide
Attached Files
File Type: docx A Notecard File Example.docx (19.6 KB, 5 views)
Reply With Quote
  #2  
Old 01-10-2022, 04:38 PM
Guessed's Avatar
Guessed Guessed is offline Looking for a randomization macro in Word 365 Windows 10 Looking for a randomization macro in Word 365 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
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

This concept appears to work IF a heading is the trigger for each block of pages (ie a paragraph which has an outline level other than body text).
Code:
Sub RandomSortOfChap()
  Dim aPar As Paragraph
  'Add random numbers on headings
  For Each aPar In ActiveDocument.Paragraphs
    If aPar.Range.ParagraphFormat.OutlineLevel <> wdOutlineLevelBodyText Then
      aPar.Range.InsertBefore Left(Rnd(1) * 100000, 4) & vbTab
    End If
  Next aPar
  'Now sort based on the random number
  ActiveWindow.ActivePane.View.Type = wdOutlineView
  ActiveWindow.View.ShowHeading 5     'show five levels of headings
  Selection.Sort FieldNumber:="Paragraphs", SortFieldType:=wdSortFieldAlphanumeric
  ActiveWindow.ActivePane.View.Type = wdPrintView
  'And remove the numbers
  ActiveDocument.Range.Select
  WordBasic.ToolsBulletsNumbers Replace:=0, Type:=1, Remove:=1
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
[Word VBA macro] How to open the website [languagetool.org] and check my Word document? citroen Word VBA 0 10-25-2020 05:07 AM
Macro to transfer data from Word to another Word document with bookmark Jovan Yong Word VBA 3 04-17-2018 04:27 AM
Macro to put 1 word of a MS Word file in 1 cell of a Word or Excel Table Singh_Edm Word VBA 6 11-13-2015 08:48 PM
Looking for a randomization macro in Word 365 Macro Question: Need help making a macro to highlight the first word in every sentence LadyAna Word 1 12-06-2014 10:39 PM
Looking for a randomization macro in Word 365 Word 2003 Macro problem running in Word 2010 norwood Word VBA 2 02-03-2014 06:49 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:42 AM.


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