VBA Macro - Save Word Documents As HTML Files

VBA Macro - Save Word Documents As HTML Files


Option Explicit

Sub Doc2HTML()

Dim MyObj As Object, MySource As Object, file As Variant
    file = Dir("C:\Temp\Test\")
    While (file <> "")
        'SaveAsHTML "C:\Temp\Test\" & file
        Dim ExtFind As Variant
        ExtFind = Right$(file, Len(file) - InStrRev(file, "."))
        If (ExtFind = "docx") Or (ExtFind = "doc") Then
                SaveAsHTML ("C:\Temp\Test\" & file)
        End If
        file = Dir
    MsgBox "Completed Sucessfully"
End Sub

Sub SaveAsHTML(myFile)
' SaveAsHTML Macro
Dim objDoc, objFile, objFSO, objWord, strFile, strHTML

    Const wdFormatDocument = 0
    Const wdFormatDocument97 = 0
    Const wdFormatDocumentDefault = 16
    Const wdFormatDOSText = 4
    Const wdFormatDOSTextLineBreaks = 5
    Const wdFormatEncodedText = 7
    Const wdFormatFilteredHTML = 10
    Const wdFormatFlatXML = 19
    Const wdFormatFlatXMLMacroEnabled = 20
    Const wdFormatFlatXMLTemplate = 21
    Const wdFormatFlatXMLTemplateMacroEnabled = 22
    Const wdFormatHTML = 8
    Const wdFormatPDF = 17
    Const wdFormatRTF = 6
    Const wdFormatTemplate = 1
    Const wdFormatTemplate97 = 1
    Const wdFormatText = 2
    Const wdFormatTextLineBreaks = 3
    Const wdFormatUnicodeText = 7
    Const wdFormatWebArchive = 9
    Const wdFormatXML = 11
    Const wdFormatXMLDocument = 12
    Const wdFormatXMLDocumentMacroEnabled = 13
    Const wdFormatXMLTemplate = 14
    Const wdFormatXMLTemplateMacroEnabled = 15
    Const wdFormatXPS = 18
    Const wdFormatOfficeDocumentTemplate = 23
    Const wdFormatMediaWiki = 24

    ' Create a File System object
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    ' Create a Word object
    Set objWord = CreateObject("Word.Application")

    With objWord
        ' True: make Word visible; False: invisible
        .Visible = True

        ' Check if the Word document exists
        If objFSO.FileExists(myFile) Then
            Set objFile = objFSO.GetFile(myFile)
            strFile = objFile.Path
            'WScript.Echo "FILE OPEN ERROR: The file does not exist" & vbCrLf
            ' Close Word
            Exit Sub
        End If
        ' Build the fully qualified HTML file name
        strHTML = objFSO.BuildPath(objFile.ParentFolder, _
                  objFSO.GetBaseName(objFile) & ".html")

        ' Open the Word document
        .Documents.Open strFile

        ' Make the opened file the active document
        Set objDoc = .ActiveDocument

        ' Save as HTML
        objDoc.SaveAs strHTML, wdFormatFilteredHTML

        ' Close the active document

        ' Close Word
    End With
End Sub


Office 365: Migrating and Managing Your Business in the Cloud (FreeeBook)

Office 365: Migrating and Managing Your Business in the Cloud (FreeeBook)
Office 365 Migrating an Managing Your Business in the Cloud
Written for the IT professional and business owner, this book provides the business and technical insight necessary to migrate your business to the cloud using Microsoft Office 365.  This is a practical look at cloud migration and the use of different technologies to support that migration.  Numerous examples of cloud migration with technical migration details are included.

Cloud technology is a tremendous opportunity for an organization to reduce IT costs, and to improve productivity with increased access, simpler administration and improved services.  Those businesses that embrace the advantages of the cloud will receive huge rewards in productivity and lower total cost of ownership over those businesses that choose to ignore it.

The challenge for those charged with implementing Microsoft Office 365 is to leverage these advantages with the minimal disruption of their organization.  This book provides practical help in moving your business to the Cloud and covers the planning, migration and the follow on management of the Office 365 Cloud services. 

What you’ll learn

-Overview of Microsoft Office 365's operation and usage for any size enterprise
-Methods of planning and migration
-Office 365 management best practices
-Using Office 365 SharePoint to improve business processes
-Troubleshooting Office 365 installations
-Using Compliance, eDiscovery and Data Loss Prevention tools
-Office 365-site management best practices for IT administrators and business owners

Who this book is for

Small-enterprise IT professionals and business owners who have the admin responsibilities for their business-IT needs. These people need refined reference information on basic set-up and configuration for their Office 365 installations, as well as best-practice-driven instruction on managing and troubleshooting their systems.

eBook Price: $0.00
Free eBook:- Office 365: Migrating and Managing Your Business in the cloud

Thanks & have fun! :)


Site and Site Collection Retention Policy in SharePoint 2013

Site and Site Collection Retention Policy in SharePoint 2013

One of the biggest problem we face in our SharePoint environment is site retention.  Whenever our users request us with new site collections/sites, we tend to ask to them to clear the security test and we create a new site collection or site.  The problem is, managing the site collections/sites.

Lots off users request sites for either long term projects, short term projects, team spaces, etc., and then they tend to forget to manage it.  These sites will reserve a big amount of space, in addition to that is a mailboxes if they have.

So finally, to resolve all the above issues (till certain point), SharePoint 2013 has came to rescue.  The new “thing” called SharePoint Server 2013 Site (or Site Collection) Policy.

As you can see from the above figure, it allows you to create a Site (or Site Collection) Policy which can be applied to restrict site’s long living life.

Site Closure and Deletion

The difference between site closure and site deletion is, site closure means that when the site is put into the closed mode, the site will NOT be active anymore, means the site is not being updated or being actively used.  You can also manually put the site on closure but to reopen the closed site, you will have to go through the site collection administrators.  When the site is being put onto the closure mode, the system will put site into read-only mode as well.  (in this case as well, only site collection administrators will be able to reopen the site).

Though the users/admins/developers can continue using the site as well as it’s contents, whereas site deletion means the site will be permanently deleted with all of it’s content.

Now, sometimes you will have to postpone the above activity, in that case, the site owner can manually delay the site deletion for a particular period of time (assign by the site policy), if not, then the e-mail would be sent to the site owners before deletion of the site and site will be deleted if no action taken.

By using the above technique, you can always apply site collection policies to each and every new site being requested, which will be deleted if not being used for a certain period of time, ensuring you will save space on your server.  This is also helpful when you want to create a site but doesn’t want to allow any changes.

You can put the site into the closure mode, making it a read-only site and avoid the deletion (I wouldn’t recommend that ), once you define the policy to be applied, you can either directly apply it using the publishing feature from the content hub or apply them during the site creation time where in users will have an option to select.  Check out the Configuring Self Service Site Creation in SharePoint 2013.

Once you set it up, you can go to Central Administration -> Self-Service Site Creation Administration and choose from below three options to make it available to the users.

Once applied, the users will be able to choose the policies while requesting a new site.

Thanks & have fun!!

Reference : Steven Boyle


Change List URL in SharePoint 2010

Change List URL in SharePoint 2010
Hey Guys,

You know we always messed up with list names in SharePoint 2010, isn't it? Yeah, so me too.

Anyways, so I found the solution to change the URL of the List, basically, there are three ways (which I know of),

First of all:

You can use SharePoint Designer 2010

1.  Open your SharePoint Site using the SharePoint Designer 2010
2.  Go to your list node from all items
3.  right click onto the list node and you can rename it

You can use Windows Explorer

1.  Browse any of your document library in the site
2.  From the default view, click on the “Open with windows explorer” option from the ribbon .
3.  In the windows explorer, go to the root folder of the site.
4. From root folder, go to the library or list you want to change.
5. Right click on the folder and rename it.

You can use PowerShell

Open the list from the site and change the root folder of the site:
if($list -ne $null){
$list.RootFolder.MoveTo($list.RootFolder.Url.Replace($oldlistname, $newlistname));

Thanks and have fun!! :)