Jump to content

JonathanWalsh2

Members
  • Posts

    7
  • Joined

  • Last visited

Reputation

0 Neutral

About JonathanWalsh2

  1. I have that already but I don’t have a csv file with it. I spent about 8hrs on it last night trying vba and also Python but I think the document has all sorts of tables embedded. The link you sent also has a split function program but you can’t use the header 1 text as the file name and they are all random numbers
  2. Hi Everyone, Looking to split a word document using the header1 feature. However I can’t use the split that built into work due to the document having tables in it. So I went down the vba route. However I keep getting errors. I’m wanting to split via header 1 tag and then use the text in header 1 as the file name. Whats wrong with my code? Thanks in advance Sub SplitDocumentByHeading1() Dim originalDoc As Document Dim newDoc As Document Dim para As Paragraph Dim rng As Range Dim title As String Dim saveFolderPath As String ' Set the folder path to save the new documents saveFolderPath = "\\SAM-FS-02\staffhome$\jwalsh\MCAS" ' Set the original document Set originalDoc = ActiveDocument ' Loop through each paragraph in the document For Each para In originalDoc.Paragraphs ' Check if the paragraph is a Heading 1 If para.Style = "Heading 1" Then ' Get the Heading 1 text as the document title title = para.Range.Text ' Create a new document Set newDoc = Documents.Add newDoc.Range.FormattedText = para.Range.FormattedText ' Set the range to include the entire new document Set rng = newDoc.Range ' Find and remove the page breaks in the new document With rng.Find .Text = "^m" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Execute Replace:=wdReplaceAll End With ' Save and close the new document in the specified folder with the title as the file name newDoc.SaveAs2 saveFolderPath & title & ".docx" newDoc.Close ' Reset the range to the original document Set rng = originalDoc.Range End If Next para ' Clean up objects Set newDoc = Nothing Set originalDoc = Nothing ' Notify the user when the splitting process is complete MsgBox "Document has been split by Heading 1." End Sub
  3. I have issues with the priorities and duplicate details. So ideally I want to start again and re-upload them as there are far too many to do manually.
  4. Is it possible to show me how to manually merge? Is it a case of going into each student record? Thanks
  5. Bromcom. I can find how to export everything else bar in the parental/priority contact information.
  6. Any way of dropping the student contact details in bulk to update details/priorities/delete contacts etc and then bulk upload? Thanks in advance
×
×
  • Create New...