Hi,
I have a excel spreadsheet that i want to import to Sql server. At present we only have text so the import was easy. But now we want to a logo to each row in the excel spread sheet. The schema of my excel spread sheet is as follows:
PlanId PhoneInfo ContInfo MessageBoard Logo(file name and Path)
01212 123-456-4512 Abc somemessage Picture
01245 PhoneNo. bca message picture
So when i add a picture into excel it doesnt insert that picture on the cell that i want to have it on .. What happens if i have a picture at the next row.
I have written the following macro that will place the picture in the active cell and this my code for it..
and this one to activate the macro when the User clicks on G2
So my first question is Can i resize the picture to fit the Cell size?
and Is there a way I can specify Target.Address = "$G$*"
Like i want the macro to run when the G cell is been clicked. and last.. How to get the pictures to be exported out of excel..
Any help will be appreciated.
Thanks a lot,
Karen
I have a excel spreadsheet that i want to import to Sql server. At present we only have text so the import was easy. But now we want to a logo to each row in the excel spread sheet. The schema of my excel spread sheet is as follows:
PlanId PhoneInfo ContInfo MessageBoard Logo(file name and Path)
01212 123-456-4512 Abc somemessage Picture
01245 PhoneNo. bca message picture
So when i add a picture into excel it doesnt insert that picture on the cell that i want to have it on .. What happens if i have a picture at the next row.
I have written the following macro that will place the picture in the active cell and this my code for it..
Code:
Dim Pict
Dim ImgFileFormat As String
Dim PictCell As Range
Dim Ans As Integer
'ActiveSheet.Protect True, True, True, True, True
ImgFileFormat = "Image Files (*.jpg),others, tif (*.tif),*.tif, jpg (*.jpg),*.jpg"
GetPict:
Pict = Application.GetOpenFilename(ImgFileFormat)
'Note you can load in any nearly file format
If Pict = False Then End
'Ans = MsgBox("Open : " & Pict, vbYesNo, "Insert Picture")
'If Ans = vbNo Then GoTo GetPict
'Now paste to userselected cell
GetCell:
Set PictCell = Application.ActiveCell 'Application.InputBox("Select the cell to insert into", Type:=8)
If PictCell.Count > 1 Then MsgBox "Select ONE cell only": GoTo GetCell
PictCell.Select
ActiveSheet.Pictures.Insert(Pict).Select
ActiveWindow.ScrollColumn = 2
ActiveWindow.ScrollColumn = 3
Selection.ShapeRange.ScaleWidth 0.4, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.4, msoFalse, msoScaleFromTopLeft
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
If Target.Address = "$G$2" Then
'do stuff
Call Macro1
End If
End Sub
So my first question is Can i resize the picture to fit the Cell size?
and Is there a way I can specify Target.Address = "$G$*"
Like i want the macro to run when the G cell is been clicked. and last.. How to get the pictures to be exported out of excel..
Any help will be appreciated.
Thanks a lot,
Karen