• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Insert File as attachment in Excel 2007

ushankar

New Member
Hello,

I need some help. I am trying to attached a file (PDF, WORD DOC or an email) to a spread sheet. This is what I am doing;

select Insert and then Object,

select the 2nd tab "Create From File"

click Browse and select a file

select option button "Display an icon" and OK


The file is attached to the spread sheet, but I see the file location underneath the file. If I double click, the file opens no problem. If I email to someone, the other person cannot open it, it is not accessible.

How do I overcome this, what am I doing incorrectly? Please help.
 
Hi, ushankar!

When you create a link for the referenced object, it's done related to where is the linked file stored in your computer. When you send the container file to another person (not necessary by mail, either shared by pendrive or cloud service), and this person downloads/copies the file, the internal link will still be pointing to your PC environment, not his.

Regards!
 
Thank you SirJB7 for the reply; my intention is not create a link. What I want is attach a file to a spread sheet and email to another person. How do I attach as a file (not as a link). I was following the above steps in my first post. Please help.
 
Hi, ushankar!

Instead of creating a link embed it within the workbook. OLE means object linking and embedding. If linking doesn't work, just try embedding.

Regards!
 
Hi SirJB7

That's great.

If I protect the sheet and try embedding a file in an unlocked range of cells, I get an error message "object cannot be inserted" . Can you please tell be how to overcome this error. I am using Excel 2007.

Thanks
 
Hi, ushankar!

What type of file are you trying to embed within the file? Would you please upload a sample file? Thanks.

Regards!
 
Hi, ushankar!


Give a look at this file:

https://dl.dropbox.com/u/60558749/Insert%20File%20as%20attachment%20in%20Excel%202007%20%28for%20ushankar%20at%20chandoo.org%29.xlsx


It's an empty Excel 2007/2010 workbook .xlsx which has embedded a Word 2007/2010 document .docx.


From Excel, Insert tab, Text group, Insert Object Embedded icon, Create From File tab, then browse, select, and set on check box of Show As Icon, and Accept. Save and close the Excel file.


Rename, move or delete the embedded file (in this case a Word document), and then reopen the Excel file, and then double click on icon.


Hope it helps.


Regards!
 
Thanks SirJB7, i am ok with this. but the 2nd problem is' let I select range B2:E15 and then goto Home / Alignment group / Protection and uncheck the locked combobox. Then Review / Protect sheet / check mark next to select unlocked cells / OK.

now select a cell within the range B2:E15 and try inserting object. I get an error message "cannot insert object". how do I fix this. please note that I have to protect the sheet and allow the other users to insert documents in a specified range only.

Thanks
 
Hi, ushankar!


You're performing the operations in the wrong sequence:

- first, unlock cells

- second, insert object

- third, protect sheet


If you set embedded object properties to Protect (default), you can't access the object.

If you set them unprotected, even with protected sheet you can access it.


Download again the same file, it's updated. Go to second sheet.


Regards!
 
Hi SirJB7,

Thank you for the post. I am getting closer but not there yet. I have a protected sheet with some unlocked cells as your second sheet. This sheet will be accessed by multiple users and I want to make sure that the attachment goes only in a specified range of cells. So the question is can I control the sequences ( - first, unprotect sheet, - second, insert object, -third, set the object properties to un-protect - forth, protect sheet)by vba codes and run this code. Let say, i put a button in cell F2 and assign these codes. At the end, when the button is clicked,

-unprotect the sheet using password

-present the dialog box to select the object and display as an icon

-attach the file

-set properties of object to unprotect

-protect the sheet with same password


thank you all your help


please help
 
Hi, ushankar!


I think I don't fully understand your requirements.


Let me start by the end: in the second worksheet, which is protected, the yellow shaded cells are unlocked, and the embedded text document is available double clicking on it. Is that what you wanted?


Now let me continue by the beginning: my doubts are,

a) who's going to prepare the document? you or other users?

b) the security you intend to implement, is for those who generate the document or for those who'll receive it?

c) is the creation of the document a one time, or once a day, procedure, or it's a highly intensive and frequent task?


Regards!
 
Hi SirJB7

The end result you have mentioned is correct. This is what I am exactly trying to achieve.

Now to the beginning part:

A) the other users, not myself. It could be a word doc or PDF or a copy of a saved outlook email or another Excel worksheet.

B) could be both. The person who creates or someone else whom just reviewing.

C) it is not one time. One day user A insert a document in one of the unprotected cell. The next day, user B add another document in a different unprotected cell.

Is this possible to do with a click on a button?


I have done something similar in a different sheet to do spell check on a proctected sheet.

Please help.
 
Hi, ushankar!


There are several issues in your requirements, as follows:

a) the three steps above mentioned were intended to be done by the person who creates the workbook with the embedded document, so as to protect the workbook and give access to the other file

b) even if you can do it within a macro, you can't assign an OLE file to a specific cell: protecting the range B2:E15 hasn't any relation with embedding the .txt sample file

c) when a person inserts (embeds) another object (file) into the workbook, there's no security schema that avoids him to delete or update the other previously embedded files, so I believe that it isn't useful to implement such a thing if it can be overridden by a lot of users.


Regards!
 
Hi SirJB7

You have been very helpful.

I understand that the embed attachment is not specific to a cell.

Can I change the requirement and allow the other users for file attachment only once then disable the button. Is it possible? Please let me know.
 
Hi, ushankar!


Yes, I think you can do it. You can place a button that embeds and object within the workbook, using a protected cell as flag for proceeding or not if there isn't an embedded file. But I still don't get the usefulness of this, if there is one. If you want to attach a file to another, why not compress them within a .rar/.zip file and avoid all the stuff of embedding? That's my humble opinion.


Despite of that, download this file and check third sheet:

https://dl.dropbox.com/u/60558749/Insert%20File%20as%20attachment%20in%20Excel%202007%20%28for%20ushankar%20at%20chandoo.org%29.xlsm


Regards!
 
Hi SirJB7

Thank you for all your valuable time. I will check the attachment tonight and let you know. I am also open to your other suggestion of .rar/.zip. This is new to me. Can you provide more details or supply a block please?
 
Hi, ushankar!


There's no block to provide. I think you've already been in contact with compressed files but maybe you don't realize because it should have been transparent for you.


There are utility programs that let you shrink and group one or more files within a unique container, called compressed file. The most popular are WinRar and WinZip, and there are also free versions like 7-Zip.


Try downloading these two files as an example. If you can open them, there you have the solution. If not, search the web for trial versions of WinRar or WinZip (I won't tell your that there are cracks too, because it's commercial software) or a free one of 7-Zip, then install it and proceed again.


https://dl.dropbox.com/u/60558749/Desktop.rar

https://dl.dropbox.com/u/60558749/Desktop.zip


Regards!
 
Hi SirJB7

No. I know about this zip file but this would not help to accomplish what I want. I have sort of a check list template. When an item is checked, I want to give the option to the user to attache a file in relation to the checked item. If multiple items are checked, then their will be more than one file placed next to the checked items.

I looked at the option button, you provided. It looks very good. Greatly appreciate all of your help.
 
Hi, ushankar!

I supposed you knew about compressed file, who doesn't?, ... my mother, my dog, ... but just in case ;)

Glad to help you. Thanks for your feedback and for your kind words too. Welcome back whenever needed or wanted.

Regards!
 
Back
Top