Word Macro to separate pages into separate documents

This little piece of code takes a word document and saves each page as its own document with the filname “FILENAME_x”. I haven’t done extensive testing, but please feel free to comment.

    Dim i As Integer
    Dim varNumberPages As Variant
    varNumberPages = ActiveDocument.Content.Information(wdActiveEndAdjustedPageNumber)
    For i = 1 To varNumberPages
        Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Count:=1, Name:=""
        Selection.Find.ClearFormatting
        With Selection.Find
            .Text = ""
            .Replacement.Text = ""
            .Forward = True
            .Wrap = wdFindContinue
            .Format = False
            .MatchCase = False
            .MatchWholeWord = False
            .MatchWildcards = False
            .MatchSoundsLike = False
            .MatchAllWordForms = False
        End With
        Selection.EndKey Unit:=wdStory, Extend:=wdExtend
        Selection.Cut
        Selection.TypeBackspace
        ActiveDocument.SaveAs FileName:="FILENAME_" & i & ".doc", FileFormat:= _
            wdFormatDocument, LockComments:=False, Password:="", AddToRecentFiles:= _
            True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:= _
            False, SaveNativePictureFormat:=False, SaveFormsData:=False, _
            SaveAsAOCELetter:=False
        Selection.WholeStory
        Selection.Delete Unit:=wdCharacter, Count:=1
        Selection.PasteAndFormat (wdPasteDefault)
        Selection.HomeKey Unit:=wdStory
    Next i
Advertisements

SharePoint folders showing as http locations and webfolders?

Check that WebClient service is running on your local machine – it worked for me!

We had this problem in our Citrix and Terminal Server environments – for whatever reason, those servers had the WebClient service disabled. Without this serivce running we experienced odd errors in various pieces of software as they would not allow saving to a http location i.e. SharePoint.

mstsc.exe /console – it’s gone with WinXP SP3!!!

I just read that the reason I can no longer use the mstsc /console command is because I’m now using SP3 on Windows XP… weird. I stopped reading the reasons why, but here is the workaround i’m using:

mstsc.exe /admin “C:\Documents and Settings\warren.rapson\Desktop\RDP.rdp”

The path of my “RDP.rdp” is just a saved rdp connection on my desktop so when I want console power, I need to edit the rdp file then use the above path.