[AccessD] Pulling Data from Excel into Access with "Automation"

Brad Marks BradM at blackforestltd.com
Fri Jul 1 13:26:32 CDT 2011


Steve, William, Darryl,

Thanks for the help with my questions.  

The advice that you provided has helped me move forward.

Below is a stripped down snippet of the Access 2007 VBA code that I put
together based on the advice you provided.

I am going to post it here in case some other "newbie" is looking for
the very "basic basics" and I am posting it here to see if anyone sees a
problem with the direction that I am heading.

Thanks again,
Brad

PS.  I also ordered a book on this subject.

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sub Pull_Data_From_Excel_Into_Access()

Dim XLApp As Excel.Application

Dim XLWorkbook As Excel.Workbook

Dim XLSheet As Excel.Worksheet

Dim Str_Value_in_Cell As Variant

Set XLApp = CreateObject("Excel.Application")

XLApp.Workbooks.Open ("C:\Book1.xlsx")

XLApp.Visible = True   ''' to see Spreadsheet

Set XLWorkbook = XLApp.Workbooks(1)

Set XLSheet = XLWorkbook.Sheets(1)

Str_Value_in_Cell = XLSheet.Cells(1, 1).Value

MsgBox Str_Value_in_Cell

End Sub

'~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 





More information about the AccessD mailing list