ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Open File with VBA (https://www.excelbanter.com/excel-discussion-misc-queries/143957-open-file-vba.html)

David T

Open File with VBA
 
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

Gary''s Student

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


David T

Open File with VBA
 
do u have a macro that will identify who is currently in the file if I am
trying to access it? Thanks.

"Gary''s Student" wrote:

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



All times are GMT +1. The time now is 06:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com