Skip to content

Instantly share code, notes, and snippets.

@thoughtcroft
thoughtcroft / IsFileOpen.vb
Created August 2, 2016 00:39
2008-08-27-is-that-file-open.md
Public Function IsFileOpen(ByVal strFullPathFileName As String) As Boolean
' Attempting to open a file for ReadWrite that exists will fail
' if someone else has it open. We also have to guard against the
' errors that occur if the file has uncommon file attributes such as
' 'hidden' which can upset the Open statement.
' NOTE: any open that doesn't lock the file such as opening a .txt file
' in NotePad or a read-only file open will return False from this call.
Dim lngFile As Long
@thoughtcroft
thoughtcroft / IsWordDocument.vb
Created August 2, 2016 00:41
2010-04-01-how-to-tell-if-a-file-is-a-word-document.md
Public Function IsWordDocument(ByVal strExtension As String) As Boolean
' Developed by Warren Bain on 01/04/2010
' Copyright (c) Thought Croft Pty Ltd
' All rights reserved.
' Verifies if the supplied file extension e.g. "doc"
' is recognised as one of the documents that this version
' of Word can natively handle. List is constructed from the
' types of documents that can be filtered in the Open File dialog