Mackeral
Board Regular
- Joined
- Mar 7, 2015
- Messages
- 249
- Office Version
- 365
- Platform
- Windows
When my program executes the last line of this code, it puts Excel into a seemingly endless loop. The only to do at this point is just kill the program with Task Manager.
Anybody know what's going on or how to fix it?
Anybody know what's going on or how to fix it?
Code:
Sub OpenDoc(File_Name) ' Open a file.
' 9/25/17 Copied from Microsoft. WML
Dim objWord As Object
Dim objDoc As Object
Dim blnStart As Boolean
' See if Word is already running; if not, start it
Set objWord = GetObject(Class:="Word.Application")
If objWord Is Nothing Then
Set objWord = CreateObject(Class:="Word.Application")
If objWord Is Nothing Then
MsgBox "Can't start Word.", vbExclamation
Exit Sub
End If
blnStart = True
End If
On Error GoTo ErrHandler
' Open document
' File_Name = "E:\Downloads\Activity (12).cvs" <-- legit ptr
Set objDoc = objWord.Documents.Open(FileName:=File_Name)
.
.