how to import to vb from open excel wk book?

ctff_1999

New member
Joined
Aug 10, 2009
Messages
1
Programming Experience
1-3
Good day to all;
I have a vb 2008 project going and I have a button to open an excel workbook.
Next I want to edit the worksheet then I want to have another button’s click event to import data from the already open worksheet. Below is the code I am using to open the workbook. I have made the declarations public so they can be called from any sub.
Dim objXL As Microsoft.Office.Interop.Excel.Application
Dim objXLBooks As Microsoft.Office.Interop.Excel.Workbook
Dim Wsheet As Excel.Worksheet
Dim RngWSheet As Excel.Range
objXL = New Microsoft.Office.Interop.Excel.Application
objXLBooks = objXL.Workbooks.Open("C:\Documents and Settings\ffredrick\Desktop\SolControl_Master_2")
Wsheet = objXLBooks.Worksheets(1)
RngWSheet = Wsheet.Cells
objXL.Visible = True

can anyone help me?
Fred
 
Back
Top