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.
Set RangeA = Worksheets(ExcelSheet).Range(ExcelRange)
Private Sub CommandButton1_Click()
Dim DBAddress As String
Dim ExcelAddress As String
Dim a As String
Dim ExcelRange As String
Dim SheetName As String
Dim NumOfRows As Double
Sheets("Sheet1").Activate
DBAddress = ActiveSheet.Range("C5")
ExcelAddress = ActiveSheet.Range("C2")
SheetName = ActiveSheet.Range("C3")
NumOfRows = CDbl(ActiveSheet.Range("F3"))
[red]ExcelRange = ActiveSheet.Range("C3") & "!" & Split(ActiveSheet.Range("C4"), ":", -1)(0) & ":" & ActiveSheet.Range("C3") & "!" & Split(ActiveSheet.Range("C4"), ":", -1)(1)[/red]
'MsgBox ExcelRange
a = Upload_To_Database(ExcelAddress, DBAddress, ExcelRange, SheetName, NumOfRows)
End Sub
__________________
Public Function Upload_To_Database(ExcelAddress As String, DBAddress As String, ExcelRange As String, SheetName As String, NumberOfRows As Double)
'On Error GoTo Errorhandler
Dim WorksheetNumber As Integer
Dim wb As Object 'Excel.Workbook
'Dim datecomp As DataTypeEnum
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim xSQLbuilder1 As SQL_INSERT_StringBuilder
Dim xSQLbuilder2 As SQL_INSERT_StringBuilder
Dim xSQLbuilder3 As SQL_INSERT_StringBuilder
Dim xSQLbuilder4 As SQL_INSERT_StringBuilder
Dim xSQLbuilder5 As SQL_INSERT_StringBuilder
Dim TimeRange As Excel.Range
Dim JobcodeRange As Excel.Range
Dim POrderRange As Excel.Range
Dim i As Long
Dim j, k As Long
Dim sqlstr
Dim wbstring As String
Dim LoginString As String
Dim workbookNeedsToBeClosed As Boolean
Dim wbtest As Excel.Workbook
Dim DRangeJob As Excel.Range
Dim ARangePO As Excel.Range
Dim DeleteSQL1 As String
Dim isopen As Boolean
Dim ExRange As Excel.Range
Dim RangeA As Excel.Range
Dim TRangeCC As Excel.Range
Dim ColumnName As String
ReDim MonthA(1 To 12) As String
'DBAddress=
'"C:\Documents and Settings\Wes\My Documents\Wesley's Documents\Tracs work\Time Sheets- Harry\Tracs Timesheets.mdb"
wbstring = ExcelAddress
Set conn = New ADODB.Connection
For Each wbtest In Excel.Workbooks
If wbtest.FullName = wbstring Then
Set wb = wbtest
isopen = True
Exit For
End If
Next
If isopen = False Then
Set wb = Excel.Workbooks.Open(wbstring)
workbookNeedsToBeClosed = True
End If
wb.Activate
LoginString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= " _
& DBAddress & ";Jet OLEDB:System database=" _
& ";User Id=" & "admin" _
& "; Password=" & ""
conn.ConnectionString = LoginString
conn.Open
'wb.Sheets(MonthA(k)).Names.Add Name:="TimeRangeC", RefersToR1C1:= _
"=" & MonthA(k) & "!R8C2:R69C9"
'Debug.Print
'ActiveWorkbook.Sheets(SheetName).Select
Set RangeA = Range(ExcelRange)
..................................
..................................
..................................
"Sheet1!A1:Sheet1!B6"
Dim RangeA As Excel.Range, ExcelRange As String
ExcelRange = "’Sheet1’!A2:D4"
Set RangeA = Sheets(Split(Replace(ExcelRange, "’", ""), "!")(0)).Range(Split(ExcelRange, "!")(1))