Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub readxlsdata()
Dim wkbData As Workbook
Dim a, b, c, d
Set wkbData = Workbooks.Open("C:\FilePath\xx.xls")
With wkbData.Worksheets("Sheet1")
a = .Range("A1").Value
b = .Range("A2").Value
c = .Range("A3").Value
d = .Range("A4").Value
End With
End Sub
Sub TTtest()
Dim wb As Workbook, blnWasOpen As Boolean
Dim a, b, c, d
If IsWbOpen("Book1.xls") Then
Set wb = Workbooks("Book1.xls")
blnWasOpen = True
Else
Set wb = Workbooks.Open("C:\YourPathHere\Book1.xls")
blnWasOpen = False
End If
With wb.Sheets("Sheet1")
a = .Range("A1").Value
b = .Range("A2").Value
c = .Range("A3").Value
d = .Range("A4").Value
End With
If Not blnWasOpen Then wb.Close savechanges:=True
End Sub
Function IsWbOpen(wbName As String) As Boolean
On Error Resume Next
IsWbOpen = Len(Workbooks(wbName).Name)
End Function