|
-
Sep 28th, 2000, 01:51 PM
#1
Thread Starter
New Member
I'm currently using Excel as part of a school project, I need to know how to get info from a text box in userform, to a specific cell in a workbook. Can anyone please help me, since quite a bit of the project is based on this feature of people entering data into user frorm created through the visual basic part, and it moving to the spreadsheet.
Thankyou
-
Sep 28th, 2000, 02:07 PM
#2
Frenzied Member
Hi.
In references, put a reference to Microsoft Excel 9.0 Library.
Then code
Dim xlsWorkBook As Excel.Workbook
Dim xlsWorkSheet As Excel.Worksheet
Command1_Click()
Set xlsWorkBook = GetObject("C:\MyDocuments\whatever.xls")
Set xlsWorkSheet = xlsWorkBook.Worksheets("Sheet1")
xlsWorkSheet.Cells(1, 1).value = Text1.Text 'This represent cell A1.
xlsWorkSheet.Cells(2, 1).value = Text2.Text 'This represent cell A2
xlsWorkSheet.Cells(1, 2).value = Text3.Text 'This represent cell B2
'when you're finished
xlsWorkBook.Close
End Sub
I think that's about it
Wen Gang, Programmer
VB6, QB, HTML, ASP, VBScript, Visual C++, Java
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|