View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Open File with VBA

http://support.microsoft.com/Default.aspx?kbid=291295
--
Gary''s Student - gsnu200724


"David T" wrote:

Hello everyone-

I have a code that opens an existing excel file but, if someone is already
in the file, it does not pop up a window that says which user is currently in
the file. Can some add to my coding so that when the file is opened and
someone is in the file it will identify who is in the file? Thanks.

Sub Open_Wiresheet()

Dim objExcel As Object
Dim SchedWkbk As Workbook


On Error Resume Next
Set SchedWkbk = Nothing

Set objExcel = CreateObject("Excel.Application")


Set SchedWkbk = objExcel.Application.Workbooks.Open _
("O:\SEM\Common\Accounting\May-07 Wire Transfer Schedule.xls
") ' WIRE TRXFER FILE
objExcel.Visible = True
On Error Resume Next


If SchedWkbk Is Nothing Then
Msgbox prompt:="Cannot find file. Please open file manually", _
Buttons:=vbOKOnly + vbQuestion

End If

End Sub