VBScript

Microsoft Word – Mail Merge Separate Documents and Save File Name as Mail Merge Variable

Setup your Microsoft Word mail merge by selecting your data source and the recipients. Don’t actually complete the mail merge.

Create two Macro’s, one called “StartMailMerge” and the other called “DoWork”.

 

StartMailMerge – Code

Sub Start()

For i = 1 To ActiveDocument.MailMerge.DataSource.RecordCount

    DoWork

Next i

End Sub

DoWork – Code

Sub DoWork()

    Dim DokName  As String

 

    With ActiveDocument.MailMerge

        .Destination = wdSendToNewDocument

        .SuppressBlankLines = True

        With .DataSource

            .FirstRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord

            .LastRecord = ActiveDocument.MailMerge.DataSource.ActiveRecord

            DokName = .DataFields("FieldName").Value      'Change "FieldName" to your MailMerge field name

        End With

 

' Merge the active record

        .Execute Pause:=False

    End With

 

' Save the resulting document.

    ActiveDocument.SaveAs2 FileName:="C:\temp\"+ DokName + ".docx", FileFormat:= _

        wdFormatXMLDocument, LockComments:=False, Password:="", AddToRecentFiles _

        :=True, WritePassword:="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts _

        :=False, SaveNativePictureFormat:=False, SaveFormsData:=False, _

        SaveAsAOCELetter:=False, CompatibilityMode:=14

 

' Close the resulting document

    ActiveWindow.Close

 

' Now, back in the template document, advance to next record

    ActiveDocument.MailMerge.DataSource.ActiveRecord = wdNextRecord

End Sub

When you’re finished, just run the StartMailMerge macro.

Trend Micro OfficeScan–Manual UnInstall–Automated

Recently I’ve been having issues on a few workstations where the Trend Micro OfficeScan installation became corrupt. Attempting to re-install OfficeScan again would result in an error message saying it was already installed. All the tools that Trend Micro provided wouldn’t remove the remnants. Trend does offer a manual uninstallation method (http://esupport.trendmicro.com/solution/en-us/1039283.aspx), but takes too much time to perform on multiple workstations.

 

I created a VBScript that automates the manual uninstallation instructions. For a small portion of the code it depends on Microsoft’s DevCon utility (http://support.microsoft.com/kb/311272) and won’t run without it. Please extract the DevCon utility to C:\Windows\System32.

 

Automated Manual UnInstall Trend Micro OfficeScan – https://www.brandonclaps.com/downloads/OfficeScan_Remove.zip

 

Hope you find this useful.