0 votes
in VBA by Beginner (2 points)

How can I get data from closed files with ADO? Is there any sample?

Thank You

1 Answer

0 votes
by Beginner (11 points)
Sub GetValueFromFile()
    Dim Ex As Excel.Workbook
    'File Path
    Set Ex = GetObject("C:\Users\à\Desktop\CCF13082019.xlsx")
    MyValue = Ex.Sheets("Sheet1").Range("A1")
    Set Ex = Nothing
End Sub


by Beginner (2 points)


Thank you for your help. But this error massage is coming. Is it possible to solve it?

Error massage

Thank You

by Beginner (2 points)


Thank you for your help. Now I am getting Error 1004.

Thank you for all
by Beginner (11 points)
I have a web filter that blocks me from this file, you can only upload your code here

Welcome to wellsr Q&A
wellsr Q&A is the VBA and Python programming community that rewards you for learning how to code.

Getting Started
VBA Cheat Sheets (On Sale Now)

Earn free prizes for asking VBA and Python questions and for answering questions asked by others in our community.

Looking for something else? Hire our professional VBA Help, instead.

What makes us different?
Our points system rewards you with a chance for free gifts based on the quality of your questions and answers. All you have to do is post and you could get rewarded, like these members:

ParserMonster $25 Amazon Gift Card
Hightree $10 Amazon Gift Card
Thales1 $10 Amazon Gift Card
runfunke $10 Amazon Gift Card
coolag $10 Amazon Gift Card
Siew Hun $10 Amazon Gift Card

So, why don't you join us? It really is an encouraging way to motivate members in our VBA and Python community.


For more programming tips visit the VBA Tutorials Blog and the Python Tutorials Blog.