read data excel spreadsheet

Forum home » Delegate support and help forum » Microsoft VBA Training and help » Read data from Excel spreadsheet

Read data from Excel spreadsheet

resolvedResolved · Low Priority · Version 2003

Kenneth has attended:
Excel VBA Intro Intermediate course

Read data from Excel spreadsheet

How do we read data from an Excel spreadsheet without opening the workbook?

RE: Read data from Excel spreadsheet

Hi Ken, thanks for posting your query. Open a new spreadsheet and write your name into cell A1. Then save that spreadsheet to c:\. Close it, and then open another new spreadsheet, Alt + F11 and create a new module with this code:

Sub ReadClosed()

Dim strPath As String
Dim strFile As String
Dim strInfoCell As String
Dim myvalue As String

strPath = "c:\"
strFile = "myspreadsheet.xls"
strInfoCell = "'" & strPath & "[" & strFile & "]Sheet1'!R1C1"

myvalue = ExecuteExcel4Macro(strInfoCell)
MsgBox myvalue
Sheets("Sheet1").Range("A1").Value = myvalue

End Sub

That should display a messagebox with the value from your closed spreadsheet and write it into cell A1 on your new sheet. I haven't tested this with vast quantities of data, but you should be able to cannibilise this code for what you want to do.

Hope this helps,


Sun 25 Jul 2010: Automatically marked as resolved.


Training courses


Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


VBA tip:

Stop Display Alerts In Excel

When creating or deleting a Worksheet in Excel you don't want Excel to inform you "A file already exists....." Or "Do you want to save this file...".

To stop these alerts happening use the following line of code:

Application.DisplayAlerts = False

After the Create or Delete routine use:

Application.DisplayAlerts = True

View all VBA hints and tips

Server loaded in 0.1 secs.