J
Jills2000
Hi,
I am new to VBA and am having problems with writing code to open word
documents in VBA. Any help would be appreciated!
My code traverses through a specified folder and finds all the Word
documents located there. When it finds these docs, it opens each in
turn and executes some code accordingly.
The problem is that if somebody is currently using that file a dialog
box comes up asking the user whether they want to open the file in
"Read-Only" or "Notify when read/write is available" mode. This causes
my program to stall until the user makes a selection.
I have been trying to get the DisplayAlerts property to stop this
message box from coming up, but with no luck.
Can somebody tell me if I'm doing something wrong??
Thanks heaps in advance
Jill
*******SAMPLE CODE********************
Sub FindLinkedDocuments()
Word.Application.Visible = False
Application.ScreenUpdating = False
Word.Application.DisplayAlerts = wdAlertsNone
Excel.Application.DisplayAlerts = False
<my code>
Word.Application.DisplayAlerts = wdAlertsAll
Excel.Application.DisplayAlerts = True
Application.ScreenUpdating = False
Word.Application.Visible = True
End Sub
I am new to VBA and am having problems with writing code to open word
documents in VBA. Any help would be appreciated!
My code traverses through a specified folder and finds all the Word
documents located there. When it finds these docs, it opens each in
turn and executes some code accordingly.
The problem is that if somebody is currently using that file a dialog
box comes up asking the user whether they want to open the file in
"Read-Only" or "Notify when read/write is available" mode. This causes
my program to stall until the user makes a selection.
I have been trying to get the DisplayAlerts property to stop this
message box from coming up, but with no luck.
Can somebody tell me if I'm doing something wrong??
Thanks heaps in advance
Jill
*******SAMPLE CODE********************
Sub FindLinkedDocuments()
Word.Application.Visible = False
Application.ScreenUpdating = False
Word.Application.DisplayAlerts = wdAlertsNone
Excel.Application.DisplayAlerts = False
<my code>
Word.Application.DisplayAlerts = wdAlertsAll
Excel.Application.DisplayAlerts = True
Application.ScreenUpdating = False
Word.Application.Visible = True
End Sub