R
red6000
Hi,
I have a macro with many userforms and have some code that records whether
each checkbox or optionbutton was selected. This data is then stored as a
string called MIDATA and added to a text file (and then this text file is
linked into an Access database)
The problem I have is that if 2 people run the code at exactly the same
file, the text file is ready-only. Is there a better way to record the data
in a file that can be accessed by multiple people. My code at the moment
is:
ChangeFileOpenDirectory _
"J:\MACRO MI\"
Documents.Open FileName:="MacroMI.txt"
Documents("MacroMI.txt").Activate
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
Selection.TypeText Text:=MIDATA
If ActiveDocument.ReadOnly = False Then
ActiveDocument.Save
End If
ActiveDocument.Close
I have thought about having some 'other' text files that the code can go to
if the main one is 'read-only', but this seems messey
Thanks for any help or pointers.
I have a macro with many userforms and have some code that records whether
each checkbox or optionbutton was selected. This data is then stored as a
string called MIDATA and added to a text file (and then this text file is
linked into an Access database)
The problem I have is that if 2 people run the code at exactly the same
file, the text file is ready-only. Is there a better way to record the data
in a file that can be accessed by multiple people. My code at the moment
is:
ChangeFileOpenDirectory _
"J:\MACRO MI\"
Documents.Open FileName:="MacroMI.txt"
Documents("MacroMI.txt").Activate
Selection.EndKey Unit:=wdStory
Selection.TypeParagraph
Selection.TypeText Text:=MIDATA
If ActiveDocument.ReadOnly = False Then
ActiveDocument.Save
End If
ActiveDocument.Close
I have thought about having some 'other' text files that the code can go to
if the main one is 'read-only', but this seems messey
Thanks for any help or pointers.