@nephilim - did you get it working?
@nephilim - did you get it working?
havent tested it as I spent the day yesterday in training and today working on a few other higher priority ones. will get too it later :)
ok, @LosOjos, got a good one for you...
replace section breaks with page breaks, then print said document, then put back the original section breaks.
I can get to the point where it prints, but wont replace the original section break.
I suppose what I'm really asking is, what is the end goal? There may be a better solution.
We have a separate software now which deals with the section breaks as it will insert PDFs or Excel spreadsheets etc into where it should go (based on pages). As such not needed anymore.
However some people add them by habit so it doesn't work with our printing macro and we have to continually help with this. So having a macro or subroutine which will do this in 1 click will save us a lot of time in a working day...both end users and us
I forgot to add...people use it mainly on older documents...not the newer ones. Should have cleared that up a bit.
@nephilim - I still don't understand how this macro would be helpful in any way, sections and page breaks are totally different things... it'd be like writing a macro to replace all the tables in the document with pictures of kittens - not what the author intended (although that sounds like an hilarious prank...)
However, I still tried! Failed, but tried lol. The code below is my attempt; I can store copies of the sections, replace them with page breaks, but then trying to iterate back trhough the document replacing the new page breaks with the original sections is where I fall down... maybe you can work that bit out from here?
Dim i As Integer
Dim savedSections() As Section
ReDim savedSections(0 To 0)
For i = 1 To .Sections.Count
If .Sections(i).PageSetup.SectionStart <> wdSectionNewColumn Then
ReDim Preserve savedSections(0 To UBound(savedSections) + 1)
Set savedSections(UBound(savedSections)) = .Sections(i)
' replace section breaks
.StartOf wdStory, wdMove
.Find.Text = "^b"
.Find.Replacement.Text = "^m"
.Find.Forward = True
' perform any actions you wish to with the newly formatted document here
MsgBox "Replaced " & Str$(UBound(savedSections)) & " sections."
' iterate savedSections array, returning section breaks to original positions
If UBound(savedSections) > 1 Then
.StartOf wdstroy, wdMove
.Find.Replacement.Text = ""
' skip first section, which is the start of the document
For i = 2 To UBound(savedSections)
.Start = savedSections(i).Range.Start
Select Case savedSections(i).PageSetup.SectionStart
I use a fair few pretty basic Macros. I sort of cheat as most of my Macros simply create and run Batch files!
I've posted this before but I shall post again, here's my main use:
The 'PowerPing' macro is my fav. Use the drop down box to select the SIMS machine on the network, hit PowerPing and it updates the status bar detailing if it's online or not, whether SIMS is currently in use, the version of SIMS and whether the SOLUS3 agent is installed. Being at the LA and having about 1500 SIMS machines on the network, it's very handy!
From there you can then delete SIMS.net, uninstall the S3 agent, set the standard Connect.ini etc etc. It all helps to save a bit of time.
@MrMat can you post up that set of macros for me please? That would be handy (though I would edit it for other programs we use here).
@LosOjos I ended up getting it to copy selection to another page, replace the section breaks with page breaks then print that, then close and leave the original unaltered...best solution around for it, but I do appreciate your help. We use a bespoke software here which will insert items into a section break then print, but if they needed to print something using our formatted macros, the section break wouldn't work within the macros. Hence this needing to be done. But thank you anyway.