Hi,
How can this code be modify just to open the file and not open a new workbook too.
When I click in the macro open the file in the path but also open a blank sheet.
here is the code:
thanks.
How can this code be modify just to open the file and not open a new workbook too.
When I click in the macro open the file in the path but also open a blank sheet.
here is the code:
Code:
Public Sub OpenVendorMappingAccountsTracking() Dim File$
Dim Xl As Object ' Excel.Application
Dim Wb As Object ' Excel.Workbook
Dim Ws As Object ' Excel.Worksheet
Dim Rn As Object ' Excel.Range
File = "C:\Users\user\Desktop\Excel Files\BILL PAYMENTS LIST.xlsm"
On Error Resume Next
Set Xl = GetObject(, "excel.application")
On Error GoTo 0
If Xl Is Nothing Then Set Xl = New Excel.Application
Set Wb = Xl.Workbooks.Open(File)
Set Ws = Wb.Sheets(1)
Ws.Activate
Set Rn = Ws.Range("a1")
Rn.Activate
Xl.Visible = True
End Sub
thanks.