Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Inserting Picture/image In Excel Cell

Hi I need to insert a logo(image) in a cell in my excel sheet.
However I am able to insert image/picture in my whole sheet but I need the image in one cell only as i need to insert other information on the same sheet.
how will i do that.
code for inserting picture in a sheet which i m using is as below:

Sub InsertPicture(FilePathName As String)
Dim ExcelApp As New Excel.Application
Dim Wkb As New Excel.Workbook
With ExcelApp
.Visible = True
Set Wkb = .Workbooks.Add
Wkb.Sheets(1).Range("A1").Pictures.Insert FilePathName
Wkb.SaveAs "C:Test.xls"
.DisplayAlerts = False
End With
MsgBox "Done"
Set Wkb = Nothing
Set ExcelApp = Nothing
End Sub

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Inserting Text Into A Cell In Excel
How do I get Excel or VB to insert some text into a cell and add text to that cell which is selected from a combo box? I.e. My eye colour is ... and then users select from a combox box and add eye colour.

Inserting A BMP In Excel Cell Through VBA Code
Can someone suggest a method to embed a BMP icon in a Excel worksheet using VBA??

Inserting Found Filenames Into The Right Excel Cell

I'm a beginner with VB 6.0. I have to use it to edit macros for MS Excel. And I encountered a problem: I can't find any command that inserts the found filename into an excel cell.

Here's the code. If anyone can help me with the editing pls help

Sub Check_documents()

Language = Worksheets("Tasks").Cells(6, 1)

Select Case Language

Case Is = "G" 'German

TaskSpalte = 40

Case Is = "E" 'English

TaskSpalte = 42

Case Is = "J" 'Japanese

TaskSpalte = 44

Case Is = "1" 'New Language 1

TaskSpalte = 46

Case Is = "2" 'New Language 2

TaskSpalte = 48

End Select


Dateipfad = ActiveWorkbook.Path & "/Documentation"
'Ordner = Left(Dateiname, 3)

For Zeile = 10 To Worksheets("Tasks").UsedRange.Rows.Count

Worksheets("Tasks").Cells(Zeile, TaskSpalte).Select

If Worksheets("Tasks").Cells(Zeile, 3) = "1" And _
Worksheets("Tasks").Cells(Zeile, 2) = "" And _
Worksheets("Tasks").Cells(Zeile, 50) <> "x" Then

Document = Left(Worksheets("Tasks").Cells(Zeile, 56), 5)

Set fs = Application.FileSearch
With fs
.LookIn = Dateipfad
.SearchSubFolders = False
.Filename = "*" & Document & "*"

If .Execute(SortBy:=msoSortByFileName, SortOrder:=msoSortOrderAscending) > 0 Then

answer = MsgBox("There were " & .FoundFiles.Count & " file(s) / document(s) found.", vbInformation + vbOKCancel, Left(Worksheets("Tasks").Cells(Zeile, 55), 8) & ".X - " & Worksheets("Tasks").Cells(Zeile, TaskSpalte))

Select Case answer

Case Is = 1 'Yes

GoTo 100

Case Is = 2 'Cancel

GoTo 1000

End Select

For i = 1 To .FoundFiles.Count

Anzeige = .FoundFiles(i)

MsgBox Right(Anzeige, Len(Anzeige) - Len(Dateipfad) - 1), vbInformation, Left(Worksheets("Tasks").Cells(Zeile, 55), 8) & ".X - " & Worksheets("Tasks").Cells(Zeile, TaskSpalte)

Next i


answer = MsgBox("No document available.", vbCritical + vbOKCancel, Left(Worksheets("Tasks").Cells(Zeile, 55), 8) & ".X - " & Worksheets("Tasks").Cells(Zeile, TaskSpalte))

Select Case answer

Case Is = 2 'Cancel

GoTo 1000

End Select

End If

End With

Documentation_Form.Caption = "Change task status"
Documentation_Form.Label1 = Worksheets("Tasks").Cells(Zeile, TaskSpalte)


End If

Next Zeile



End Sub

Maintaining Excel Cell Formatting When Inserting New Line
I have extensive C++ knowledge but unfortuneately know zip about basic. In excel I have formated various rows with formulas but when I insert new rows they are unformatted blank cells. What code would I need for a macro that would automatically format insert lines in a column.

Set Name Of Picture Which Inserting In Excel
I have insert a picture in Excel with VBA code and i want to set some properties of picture but i dont know the name of picture. How to set the name of picture for can set properties?

I think that the reference for picture with name "Picture 1" is ActiveSheet.Shapes("Picture 1") but how to set the name (e.g. "Picture 1")?

Inserting .gif Image In Excel Using VB
I need to embed one logo in my excel sheet which i create using VB. I am able to insert the image in excel file from my system, but when i will make exe and run it on another system, the image file is now available as the path has been hardcoded in teh vb code. How can i work around this situation. also i have written teh code for this in module and hence not able to insert imagelist also.
can anyone help?

Place Picture In An Excel Cell
How do I place a picture in a Excel cell thro' VB Program. Please help


Excel Macro-image To Cell
I need to create a new toolbar button that when pressed will insert a tiff image into a cell within Excel 2000. I know how to create the toolbar button and how to apply the macro but I need the VB code .


VBA In Excel - How To Copy A Jpg Picture From Shape To UserForm.Image
Hi, becauce I have difficulties with programatically filling UserForm.Image with a jpg file (it is decompressed by Excel and saved probably as bmp later, so that the .xls file gets really big), I would like to copy the image from a hidden Shape placed in the Excel sheet to a UserForm.Image on runtime. Please can anybody tell me how to copy it, if it is possible? Kind regards, Karel Rys

Setting Picture Property Of Image Control In Word From Excel
I have a button on my Excel 2003 sheet that (among other things)
is suppose to change a little pic on my Word 2003 quote document
to reflect the quoting currency (US flag, Canada flag, Euro flag, etc)

Run-time error '-2147418113' (8000ffff)
method 'picture' of object 'IImage' failed

the line it barfs on is:
wdDoc.imgCurrency.Picture = LoadPicture("V:euro.bmp")

I'm assured that I've declared and refered to the doc correctly as my costs & expenses successfully updates from Excel to Word

Any thoughts?

Pls & Thx

Inserting Image In Vb Project As Per Database(as Data Changes Image Should Also Change)
i am making front end in vb6 and backend in ms access
i want as my data changes on movenext
concerned photo should also change
i am using data environments

please help

Inserting PDF File Image Into A Image Field In SQL Server
I need to insert the pdf binary file into a field in a SQL Server 2000 table. The field is an image type. I currently use the Atalasoft Image OCX to upload tif and jpg images to the table, but it does not support PDF formats. I need a 3rd party OCX that will allow me to load the image via AppendChunk and then also read it with GetChunk. I am also looking for the control to possibly get me thumbnails of the pages.

How To Scroll Picture Box Image While Image Size Is Bigger Then Picture Box

I want to know how to add scroll facility in picture box while image size is bigger then picture box.

Varun Jain

Inserting Workbook Name In Cell
I would like to reference the workbook name in a formula in a cell. The workbook is named from the date it's data refers to. (03232006.xls) It also references data in several other workbooks that include the same date in their names. (03232006-3.xls, 03232006-28.xls, 03232006-31.xls, etc...)

I have a script which auto-generates the files from our Call Management System. Each day a new batch of files are created (with the date as part of the name. What I would like to do is have each day's master workbook (minus the "-xx" in the name) automatically refer to the appropriate supporting files created that day. One way to do that would be if the cell formulas could refer to the workbook name, and automatically update if the name changes.

Thus a cell that refers to "=WbName" would equal 03232006 for the file 03232006.xls, but would change to 04072007 if the workbook were renamed to 04072007.xls.

Inserting IF Statement Into A Cell
I am trying to insert an IF statement into a cell in Excel.

My VBA code goes like this:

ActiveCell.FormulaR1C1 = "=IF(a10=""NC"",""NC"",0)"

But shows up in the cell as this:


places ' ' around a10 which evaluates the formula to:

#NAME? error

what gives?

Inserting A Symbol Into A Cell
How can I use Range("").Formula = to insert an infinity symbol into the specified cell?

I tried using the macro recorder method and I am left with a question mark.

Can you use unicode? The unicode hex is 221E.

Inserting A Combobox Into A Grid Cell
I am trying to take a grid cell from the MSFlex Grid and super impose a combobox into it. Anyone know what the correct syntax is?


Inserting A Cell In The Middle Of Data
Hi all,

I am currently trying to insert cells into excel via VB when a certain condition is true.

i am trying this, but it doesnt work

XL.cells(row , col).insert

I do not wish to enter anything into that particular cells, but to just leave it blank.

The cell is in the middle of data, and I can not loose any data which is why it will have to be an insert as apposed to

XL.Cells(Row, Col) = " "

Please help


Inserting Cell References Into Cells Using Variables To Denote Columns
Looking at the standard of the other questions on this board, this'll probably be pretty easy but what the hell, I'm new to VBA.

When I'm inserting cell references into cells using code, I want to be able to use variables.

E.g., say I want the active cell to reference to cell "C2", using variables. I've tried R1C1 notation, as shown below:

Sub InsertR1C1Reference()

Dim TheRow As Long, TheColumn As Integer

TheRow = 2
TheColumn = 3

ActiveCell = "=R" & TheRow & "C" & TheColumn

End Sub

However, this gives absolute references ("=$C$2"), and I want relative ones. I can use the code below to get a relative reference, but I can only do it for the row, not the column:

Sub InsertA1Reference()

Dim TheRow As Long, TheColumn As Integer

TheRow = 2
TheColumn = 3

ActiveCell = "=C" & TheRow

End Sub

What I'm hoping is that there's a feature in VBA that lets me convert an integer into its alphabetic equivalent (1 = A, 2 = B etc.). Failing that, perhaps there is another workaround?

Any help is appreciated, but bear in mind that I need this code to run quite quickly, so the faster the better.

Excel - Making A Cell Equal To The Value Of The Formula In The Cell
I thought I'd seen something on this already, but I coudln't find it. My appoligies if I'm creating a duplicate thread.

I'm writing a macro in excel to fill in data in a database. Unfortunately, my titles for each entry have to be taken from multiple cells and put into one cell. The code to place the title in the title cell is:

Code:Dim title As String
    title = inputname & "!$B$3, " & inputname & "!$C$3, " & inputname & "!$D$3, " & inputname & "!$E$3, " & inputname & "!$F$3, " & inputname & "!$G$3, " & inputname & "!$H$3, " & inputname & "!$I$3"
    title = "=CONCATENATE(" & title & ")"
    ActiveCell.Value = title

It works fine. The problem I'm having is that every time I save and reopen my database excel pops up with this "The workbook you opened contains automatic links to information in other workbooks..." It's getting very annoying. And it also gives me problems if anybody touches the already filled title cells. I was thinking that there might be a way to make the formula equal to the value of the formula. For example making a cell have the value 4 instead of the forumula "=2+2". Thanks for any help.

How To Link An Excel Cell To An Access Table Cell
I am trying to import an populated excel form into access using just specific cells (where the data is located) only. I am able to open excel and get the data from the cells but how can i assign them back to my access table? This is like importing a populated excel form into access database.

I used these to get my excel info

Set excel_app = CreateObject("Excel.Application")
excel_app.Visible = False
excel_app.Workbooks.Open FileName:=mypathname & myfilename
Set excel_sheet = excel_app
x= excel_sheet.cells(10, 4).Value 'To get the excel cell value'
y= excel_sheet.cells(12,4).Value

Now I want x to be assigned to table "AppendTable" in column "AppColumn1"
and y in column "AppColumn2"


Inserting Picture
Could anyone please tell me how can i insert images into a Rich Text Box.

Thanks in advance.

Inserting Picture

i have an existing program connecting to SQL Server 2000.. and in this program i have a student form where i can add, edit, delete all the student data.. and i want to put an image (student picture) in that form... and i want to bind the image in one field..

can anyone help me..?

snapshot of my form attached here..

Inserting A Picture
How to Insert a Picture in Database (Access / SQL) through VB.

Please let me know


M. Venkataraman

Inserting Image...
Hi All,
In my application i need to insert image in my database.So i am using the following line of code to save the image in the database, where strlogo will contain my image path and saveimage function will return byte.
rs.Fields("imgaccountlogo").AppendChunk saveImage(strLogo)
This works fine for MS-Access and MS SQL Server database.But for postgresql if i use this method i get "Operation is not allowed in this context.Run time error 3219. I am using bytea datatype in postgresql .Can anyone give me a solution to proceed further.Thanks in advance.

Inserting .gif Image
i have a form with a text box on and would like to insert an image into it providing that the correct 4 digit number is typed in to the same textbox to start with. if the wrong 4 digit number is typed in, a msgbox to appear with a msg to say so, please help as this is very frustrating for a beginner like myself
thanx in advance

Thanks in advance for any help in this matter

Inserting Picture From Vba Form

I have very limited knowleadge of word currently i have a form which inserts txt at bookmarks using

.Bookmarks("bookLogo").Range _
.InsertBefore textbox.text

I want to to insert a pic there instead of text how would i go about that
please help

Trouble Inserting Picture In VBA
I am trying to create a macro that inserts a picture then sets it to a spot on the page. But when try recording a new macro, I insert a picture but I can't access the wrapping styles. Since I can't access that, it means I can't anchor the picture to a spot on the page.

Can someone please help?


Inserting Picture From Computer To Pic Box
This is what I have

Set picout.Picture = car.jpg

I am getting "object required" error. I have the car picture saved in the same directory as the project. Thanks.

Inserting Picture Onto Buttons
can someone guide me how to do that?
and anyone know where to download these picture for buttons such as load, save, new, etc?

Inserting Picture In Access
I want to save a picture displayed in a picture box in a database. I created an access database with an OLE field.
when i write
it shows database conversion error.
How can I do it??

Inserting Picture In An OLE Object

I am using Access 2003 as front end and back end of my program.
I am trying to add a picture to a OLE Object but having an error number: 2753: "A problem occured while Mocrosoft Office Access was communicating with the OLE server or ActiveX control."

EmpPhoto is the OLE object
file name is the file path of the picture
Code: With Me.EmpPhoto
        .Enabled = True
        .Locked = False
        .OLETypeAllowed = acOLELinked
        .Class = ".bmp"
        .SourceDoc = fileName
        .SourceItem = ""
        .Action = acOLECreateLink    'error 2753 occur
        .SizeMode = acOLESizeStretch
    End With

When I comment the ".Action" no error occur but the picture does not appear.
am I missing a reference? or is there something i missed in my code?

Hope u can help. Thank you......

Edited by - ghiey on 11/8/2005 9:18:10 PM

Inserting Image In A Text Box
is it possible to insert an image into your textbox?

i have this textbox i called comments, in there i type all the comments i have. can i insert image with it along with my type comments.

is this possible in Access form? how about in VB form?

pls help. Thank you

Inserting An Image Into Word

I am printing a 'confirmation letter' in Microsoft Word from VB. I am loading all the contents of this letter dynamically and I have everything working except for the company logo.

How do you insert an image into the TOP LEFT corner of microsoft word, forcing any text to wrap around it on the right?

I have tried making a macro in word and then copying the vba code but the image never gets copied to the top left corner.

Please help!

Inserting Image File
Dear Respondent(s)

I'm using a Ms-Access db with a table named Tbl_photo.
The fields in the table are
1. Photo_File_Location Text 50
2. Photo_file_used OLE LINK

I need to insert photos in the table. But there are about
70000 photos to be inserted....

Is there any possibility that a program will update the required ole objects (say jpg files) in the table ?

If so kindly suggest ASAP.

My work is held due to this...

Thanks & Regards

Kunal Singh.

Inserting An Image Into An OLE Field
How can I insert an image (i.e. a jpg file) into an OLE field in an Access database?

Thanks in advance!!

Sql Image Inserting And Retriving
I am using visual basic 6.0 connecting to sql server 2000. I want to save and retrive image to sql database. Do some one have the coding or have link for referance. Thankyou.

Inserting Image Into Sql Database
i am designing an sql database program and i want to insert an image into the database but i am using sql statement in my program and would like to mentain it. So i want someone to help me with how to insert and retrieve the image into the database using sql statement in my vb program.
Note i'm using VB6 and ADO 2.6

Inserting Image To SQL Server Db
I've asked this before, but I still don't have a clear answer. I need to know how to insert an image into a table on a SQL database from a MS Access database. I know how to connect to the db and everything, but I don't know what to say in VBA. Do I do like a GetObject() or something? Thanks.

- bungee41

Edited by - bungee41 on 1/25/2005 8:56:05 AM

Inserting Image Into A Table
is it possible to save a picture into a field in an oracle table.
If so how?I want to know which datatype i have to selcet. Is BLOB ok for this purpose.

Inserting PictureBox Picture Into Word
How do I go about doing this?

Inserting A Picture Into A Word Document With VB

I am trying to upload a picture into the header of my template from VB. My code to do this is:

Selection.InlineShapes.AddPicture FileName:= _
"C:folder1folder2picture.gif", LinkToFile:=False, _

I now want to specify the size of the picture and its position. The only code I know is as follows:

Picture.Height = 1.03
Picture.Width = 2.28

Can anybody give me more code to control the size and position of my pic?


Inserting A Picture Into Crystal Report
If I have an Access table:

Product.ProductID AutoNumber (Primary key)
Product.ProductName Text
Product.Description Text
Product.PictureFilename Text

How can I insert a picture (*.JPG) of my product into
a Crystal report into the details section ?

Can anyone help me.


Inserting PictureBox Picture Into Word
How do I go about doing this?

Inserting Or Loading Picture From A Folder
hi..can anyone help me with my problem. how can i load a picture that i save from a folder into a picture box base on the ID number from my database using visual basic and mysql database. can any help me pls.

Inserting A Picture Into A Database Field
Hi everyone,

I'm new to this forum, so hopefully it helps me out.

I'm looking for someone to help me out with a problem I have trying to insert a picture into a database field.

The user selects a file via a file selector, typically a JPG, BMP, GIF, etc. I then need to be able to insert that file programmatically into a database table / field.

Asumming the table name is "TABLE", field name is "FIELD" and the file name the user selected is "IMAGE.JPG", could someone please show me some code that would allow me to insert the IMAGE.JPG file into the TABLE.FIELD field.

Thanks in advance,

Inserting A Picture From A Database Into Word
I have a picture stored in an Access database, it is not stored on the hard drive anywhere, it is only in the database. I use the Word object to create a Word document in VB6 and I need to be able to insert the picture that is in the database into the Word document as I am building it in code. Can anyone help with this? Thanks.

Image Control Generates Error If Image's Path Is Assigned To Picture Property
I m storing .jpg file path in a field 'ImagePath' which is of type 'Text' of say table A. Now i want to display that .jpg file whose path is stored in the table A into an Image Control. the picture property of the image control doesn't takes the path string... and prompts an error message that object is required.. ! how to display the image in the Image control.

thanx n regards

Storing Image In Access Database From Image Control /Picture Box
I am trying to store/retrieve pictures (bmp,jpeg) as fields in a
database record. Other than GetChunk/AppendChunk is there a way to directly
assign the picture to/from a picture control to a database field?
this is b' cos i hv n image in a picturebox/ image control from where i m unable to have the filepath to assign the appendchunk method ..

Pl Help,


Copyright 2005-08, All rights reserved