PDA

View Full Version : Solved: Insert File(s) In to the main xls file



dansam
02-13-2007, 08:54 AM
Hi
Is there a way to insert any file in a *.xls file? Here with the word ?insert? I mean to say that completely insert that file in the *.xls file. (The same way we insert pictures so the source pictures are not needed to view the pictures in that file.)

I want to know this because if it is possible then I want to insert a *.pdf file in to the *.xls file (so I don?t have to carry the *.pdf file with *.xls file)?? :think:

Regards,
Dan

mvidas
02-13-2007, 09:35 AM
Hi Dan,

Go to Insert, then Object, then the Create from File tab, and make sure 'Link to file' is unchecked.

If you're looking for VBA:Sub EmbedFileToActiveCell()
Dim vFile As String
vFile = Application.GetOpenFileName("All Files,*.*", Title:="Find file to insert")
If LCase(vFile) = "false" Then Exit Sub
ActiveSheet.OLEObjects.Add FileName:=vFile
End SubMatt

dansam
02-14-2007, 12:31 AM
Hi,
any one knows what to do if i want to insert that file in a userform?

mvidas
02-15-2007, 07:17 AM
I'm not sure I understand what you're asking.. what are you looking to accomplish?

dansam
02-15-2007, 08:28 AM
Hi ,
I just want to add a pdf reader control to a userform but it must be Embeded.

mdmackillop
02-15-2007, 12:47 PM
Have a look at Tools/Additional Controls to see if there is such a thing.

mvidas
02-15-2007, 01:37 PM
I have a control called Adobe Acrobat Control for ActiveX, it probably got added to my system when I installed the acrobat reader. I added one to a userform then put this in my userform code:
Private Sub UserForm_Initialize()
Pdf1.LoadFile "C:\myfile.pdf"
End SubAnd it did work. However if you are embedding the pdf file into the workbook, I'm not sure how you'll be able to do this.
Matt

dansam
02-16-2007, 12:36 AM
Hi ,


"However if you are embedding the pdf file into the workbook, I'm not sure how you'll be able to do this."

yes I want to insert embeded control , but
thanks for help

mvidas
02-16-2007, 07:50 AM
Embedding the control into the userform is easily possible (and should work as long as the user has the acrobat reader installed). So if all you're looking to do is display a PDF the user has on their PC, it would be possible.

However, if you want to embed the PDF file into the excel file too, and show that embedded PDF file in the pdf control of the userform, that is what I am unsure of how to do. You'd be better off just using a hidden sheet to put whatever text you want to display, and then read that text into a textbox, label, or listbox on the userform.

Wish I could help more