Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 10th, 2007, 02:06 AM
Registered User
 
Join Date: Mar 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Change embeded pictures in excel to file names

Hi I have a big problem here that I can't seem to fix.
I have excel spreadsheet with embedded pictures in it and I need to replace it with file names instead of the picture AUTOMATED.

So what I need is a way to export the pictures in excel, give it a file name, then replace that embedded picture in excel with that file name or create a another column with the file name of the embedded picture.

What I am trying to do is create a website with vendor price lists that I get in excel. The people refuse to send me pricelist with picture names and they won't give me the database. So I am stuck.


HELP!!!

Thanks!
 
Old April 13th, 2007, 05:54 AM
Registered User
 
Join Date: Apr 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi dude,

you need to turn the image into a background image of a chart and then export the chart as a picture - .jpg .bmp .gif

I had the same problem and managed to sort it. I had a work book with fifty sheets and wanted to export the picture from each sheet and save it as a filename that was also on that sheet.
Here is the code i used, feel free to modify it for your purposes.

Public Sub Export()

        Dim objTemp As Object
        Dim objHolder As ChartObject
        Dim sngWidth As Integer
        Dim sngHeight As Integer
        Dim TheFilename
On Error GoTo skip


TheFilename = Cells(3, 11).Value

   'sets the picture as a temp object
Set objTemp = ActiveSheet.Shapes(2)

ActiveSheet.Shapes(2).Select

    Selection.ShapeRange.ScaleHeight 1#, msoTrue, msoScaleFromTopLeft
    Selection.ShapeRange.ScaleWidth 1#, msoTrue, msoScaleFromTopLeft
    sngWidth = objTemp.Width
    sngHeight = objTemp.Height


 Charts.Add
            ActiveChart.Location Where:=xlLocationAsObject, Name:=SheetNo
            Set objHolder = ThisWorkbook.Worksheets("Sheet1").ChartObjects(1)


With objHolder


                    .Width = sngWidth + 20
                    .Height = sngHeight + 20
                    objTemp.Copy
                End With


 With objHolder

                .Chart.Paste
                With .Chart.Shapes(1)
                    .Placement = xlMove
                    .Left = -4
                    .Top = -4
                End With
                .Width = sngWidth
                .Height = sngHeight
                .Chart.Export Filename:="C:\Photos\" & TheFilename & ".jpg", FilterName:="JPG"
                .Chart.Shapes(1).Delete

            End With
skip:



End Sub


 
Old October 30th, 2012, 04:46 AM
Registered User
 
Join Date: Oct 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi guys - I know this thread is very old but I thought I'd post just in case:

I have 4000+ survey responses and many of the rows have a photo of the respondent (optional). I need to extract these embedded images and put them online so I can access them as a url.

I have a simple row of data and at column H (optionally) has an embedded image. I want to be able to:
a) export that image to a folder
b) insert the filename for the above image to column I?

I have your VBA code on with a similar solution for exporting images as the background of a cell... However, I cannot follow the logic and I cant help but think there may be a simpler way of doing this...

Thanks for any advice or tips on creating a simpler function for this.

I am using Excel 2007 on a windows 7 home OS.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Pictures in Automation of Excel gardengirl447 BOOK: Access 2003 VBA Programmer's Reference 2 July 4th, 2011 06:54 PM
Save Pictures outside Excel jud_ltd Excel VBA 1 May 7th, 2006 08:26 AM
Find Unknown Worksheet Names in an Excel Workbook bcarmen VB.NET 2002/2003 Basics 1 March 3rd, 2005 12:20 AM
reading file names riteshu C++ Programming 3 September 22nd, 2004 05:13 AM
Excel Embeded Doc bwood415 Excel VBA 0 September 10th, 2004 06:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.