K
KC8DCN
Hello,
I have a macro which pulls in text files into a Word document:
Sub MergeTextFiles()
Documents.Add
ChDir ("C:\Documents and Settings\User\My Documents")
'Change the path above to point to the new text files
myName = Dir("*.txt")
While myName <> ""
With Selection
.InsertFile FileName:=myName, ConfirmConversions:=False
.InsertParagraphAfter
.InsertBreak Type:=wdSectionBreakNextPage
.Collapse direction:=wdCollapseEnd
End With
myName = Dir()
Wend
MsgBox ("Done.")
End Sub
When one user runs the macro, it works just file. However, when another
tries to use it (on the same computer), I get a Run-time 5097 error. I've
searched around and tried editing Word to run under each user, I've deleted
temp files to ensure enough space, etc., but I haven't figured anything out.
Any suggestions?
Thanks.
I have a macro which pulls in text files into a Word document:
Sub MergeTextFiles()
Documents.Add
ChDir ("C:\Documents and Settings\User\My Documents")
'Change the path above to point to the new text files
myName = Dir("*.txt")
While myName <> ""
With Selection
.InsertFile FileName:=myName, ConfirmConversions:=False
.InsertParagraphAfter
.InsertBreak Type:=wdSectionBreakNextPage
.Collapse direction:=wdCollapseEnd
End With
myName = Dir()
Wend
MsgBox ("Done.")
End Sub
When one user runs the macro, it works just file. However, when another
tries to use it (on the same computer), I get a Run-time 5097 error. I've
searched around and tried editing Word to run under each user, I've deleted
temp files to ensure enough space, etc., but I haven't figured anything out.
Any suggestions?
Thanks.