Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Textbox to Excel Cell

Status
Not open for further replies.

access101

Programmer
Sep 4, 2010
68
US
i have 5 textboxes driver 1,2,3,4,5 im trying to save the information to cells in my excel spreadsheet but when i run it and open excel nothing is saved? This is what i have so far

Sub saveWSR(ByVal b, r)

Dim XLapp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
Set XLapp = CreateObject("Excel.Application")
Set xlBook = XLapp.Workbooks.Open("C:\Driver\Driver.xls")
Set xlSheet = xlBook.Worksheets("DRiver")

r = r
b = b
For a = 1 To 5
xlSheet.Cells(r, b).Value = Me("drName" & a).Value
xlSheet.Cells(r + 1, b) = Me("totalSales" & a).Value
xlSheet.Cells(r + 2, b) = Me("netSales" & a).Value
xlSheet.Cells(r + 5, b) = Me("creditCards" & a).Value

xlSheet.Cells(r + 7, b).Formula = "20"


b = b + 1
Next a

XLapp.DisplayAlerts = False
XLapp.Quit

Set xlSheet = Nothing
Set xlBook = Nothing
Set XLapp = Nothing

end sub
 
...
xlBook.Save
XLapp.Quit
...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top