Solved Opening an embedded Excel file and fill it up (1 Viewer)

freuzo

Member
Local time
Today, 05:37
Joined
Apr 14, 2020
Messages
98
Hi everyone,
I have and excel file attached and I want to open that file directly from vba without saving it first. So, after the file has been filled, I set it visible to the user whom can decide to save it later.

I'm using late bidind and know how to open and manipulate file but never did it with and embedded file.

Thanks.
 

GPGeorge

Grover Park George
Local time
Yesterday, 21:37
Joined
Nov 25, 2004
Messages
1,829
Perhaps we'd benefit from a bit of clarity. What do these two terms mean?

"I have an excel file attached..."
"...an embedded file"
 

freuzo

Member
Local time
Today, 05:37
Joined
Apr 14, 2020
Messages
98
Perhaps we'd benefit from a bit of clarity. What do these two terms mean?

"I have an excel file attached..."
"...an embedded file"
I meant an Excel file embedded in a table of my database.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:37
Joined
May 7, 2009
Messages
19,231
embedded as an Attachment?
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 12:37
Joined
May 7, 2009
Messages
19,231
see this demo.
Table1 has attachment field ExcelFile.
see the code on the Button on how to extract the workbook and open it.
there is no Late/Early binding on the code and no Reference made to Excel Object Library.
 

Attachments

  • ExcelAttachment.accdb
    500 KB · Views: 174

isladogs

MVP / VIP
Local time
Today, 05:37
Joined
Jan 14, 2017
Messages
18,209
Although it is possible to add an Excel file as an attached file in Access, it is both a bad idea and unnecessary.

It is a bad idea as attachments bloat your database and make it difficult to manage the Excel file.

It is unnecessary as you can link to the Excel file as a linked table and it will then always remain up to date.
Or you can just import the file as a local table. That may be better if you no longer intend to do any further edits in Excel
 

freuzo

Member
Local time
Today, 05:37
Joined
Apr 14, 2020
Messages
98
see this demo.
Table1 has attachment field ExcelFile.
see the code on the Button on how to extract the workbook and open it.
there is no Late/Early binding on the code and no Reference made to Excel Object Library.
Your demo wasn't exactly what I wanted it did the job, so thank you.
- extracting the file in the Temp folder,
- Gettting the file path and passing it to my line workbook.open(filepath) and open it to do what I want

My initial goal was to somehow pass the attached file location directly to the workbook.open line (so without having to store it first in a folder).
 

freuzo

Member
Local time
Today, 05:37
Joined
Apr 14, 2020
Messages
98
Although it is possible to add an Excel file as an attached file in Access, it is both a bad idea and unnecessary.

It is a bad idea as attachments bloat your database and make it difficult to manage the Excel file.

It is unnecessary as you can link to the Excel file as a linked table and it will then always remain up to date.
Or you can just import the file as a local table. That may be better if you no longer intend to do any further edits in Excel

Yes but for this particular case I dont want the users to access the original template. I don't want any alteration on its design.
 

isladogs

MVP / VIP
Local time
Today, 05:37
Joined
Jan 14, 2017
Messages
18,209
Yes but for this particular case I dont want the users to access the original template. I don't want any alteration on its design.

Not a problem. The design of linked Excel tables cannot be directly altered from Access.
In fact, the linked Excel data is also read only in Access by default
 

Users who are viewing this thread

Top Bottom