LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default create images based on Excel data

SyntaX TerroR,

Let's assume that you have a table of values that you want in the signature. For the example below,
the first column of the table must contain a unique string for the export filename. Then the next
columns need to each contain what should go on separate rows of the signatu name in one, address,
etc. in each of the next columns....

Set up a single cell (in this example, H10) tall and wide enough to contain all the signature data
and your logo file. Also, select all the cells and turn the cell borders to white, so that they
don't show up in the gif file. I inserted the logo to the left of cell H1, and right aligned the
text. Then select the data table (all columns, but not the header row), and run the macro
Export_SignatureFiles. It will take a while, since GIF export is slow in Excel. You can use
multiple cells, whatever, but the basic technique works fine.

HTH,
Bernie
MS Excel MVP


Option Explicit
'Based on Harold Staff's code
'see http://www.mvps.org/dmcritchie/excel/xl2gif.htm
Dim Container As Chart
Dim ContainerBook As Workbook
Dim Obnavn As String
Dim SourceBook As Workbook

Sub Export_SignatureFiles()
Dim ExportAddress As String
Dim SaveName As Variant
Dim MySuggest As String
Dim Hi As Long
Dim Wi As Long
Dim Suffix As Long
Dim myCell As Range
Dim i As Integer

ExportAddress = "$H$10"

Set SourceBook = ActiveWorkbook

For Each myCell In Selection.Columns(1).Cells

MySuggest = myCell.Value
ImageContainer_init
SourceBook.Activate
SaveName = MySuggest & ".gif"
Range(ExportAddress).Value = myCell.Offset(0, 1).Value
For i = 3 To Selection.Columns.Count
Range(ExportAddress).Value = Range(ExportAddress).Value & Chr(10) & myCell.Offset(0, i - 1).Value
Next i
Range(ExportAddress).CopyPicture Appearance:=xlScreen, _
Format:=xlBitmap
Hi = Range(ExportAddress).Height 'adjustment for gridlines
Wi = Range(ExportAddress).Width 'adjustment for gridlines
ContainerBook.Activate
ActiveSheet.ChartObjects(1).Activate
MakeAndSizeChart ih:=Hi, iv:=Wi
ActiveChart.Paste
ActiveChart.Export Filename:=LCase(SaveName), FilterName:="GIF"
ActiveChart.Pictures(1).Delete
SourceBook.Activate
ErrHandler:
On Error Resume Next
Application.StatusBar = False
ContainerBook.Saved = True
ContainerBook.Close
Next myCell
End Sub


Private Sub ImageContainer_init()
Workbooks.Add (1)
ActiveSheet.Name = "GIFContainer"
Charts.Add
ActiveChart.ChartType = xlColumnClustered
ActiveChart.SetSourceData Source:=Worksheets(1).Range("A1")
ActiveChart.Location Whe=xlLocationAsObject, _
Name:="GIFContainer"
ActiveChart.ChartArea.ClearContents
Set ContainerBook = ActiveWorkbook
Set Container = ActiveChart
End Sub

Sub MakeAndSizeChart(ih As Long, iv As Long)
Dim Hincrease As Single
Dim Vincrease As Single
Obnavn = Mid(ActiveChart.Name, Len(ActiveSheet.Name) + 1)
Hincrease = ih / ActiveChart.ChartArea.Height
ActiveSheet.Shapes(Obnavn).ScaleHeight Hincrease, _
msoFalse, msoScaleFromTopLeft
Vincrease = iv / ActiveChart.ChartArea.Width
ActiveSheet.Shapes(Obnavn).ScaleWidth Vincrease, _
msoFalse, msoScaleFromTopLeft
End Sub





"SyntaX TerroR" wrote in message
...
Hi,

In our company we have an internal phonebook list in Excel, which also
includes e-mailaddress, function, etc.

I would like to combine these data per person, add a logo and have the whole
thing exported as an image. The idea is that we can then use this image as a
signature in Outlook (to prevent unauthorised editing).

Is there any way I can automate this for 75 people?

Thanks in advance!



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
display different images based on cell value? deisenlohr Excel Worksheet Functions 1 August 4th 06 04:58 AM
I have 5 columns of data and want to create combinations based on Carbob Excel Discussion (Misc queries) 0 June 2nd 06 04:58 PM
Create List based on cell data CWatsonJr Excel Discussion (Misc queries) 3 September 20th 05 07:10 PM
Dynamically create worksheets in Excel based off existing data? tlozier Excel Discussion (Misc queries) 1 September 10th 05 12:25 AM
create a data-series based on two different columns of data ? Derrick Charts and Charting in Excel 1 June 20th 05 01:51 PM


All times are GMT +1. The time now is 10:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"