Hi all,

I am a newbie when it comes to programming in VB and I have made a form that gets filled in by engineers on a call out. They are required to fill it in with as much information as possible and if they take pictures they are required to add those as well. Once the report is filled in they then click a button, which takes all the data, pastes it into another sheet and removes the blanks and formats it as an abridged summary less any parts of the form that were not relevant or necessary. It also takes all the data and writes it to another spreadsheet which acts like a database if required.

Now all this works brilliantly, however the attaching of pictures is my problem. I wnat to be able to insert pictures into the original form using vb script buttons. The click brings up a browser window whereby they navigate to the picture and insert it into the sheet. This picture should be sized to fit into a specific number of cells and then named with an identifier that would enable me to later when creating the summary, copy it across and paste it into the summary at the bottom of the report, followed by up to 3 more pictures with the same principle placing them underneath each other.

I am really struggling with this, so far my code looks like:


Photo:
Dim szPicFileName As String
Dim rFirstRow As Long, rLastRow As Long
Dim cFirstColumn As Integer, cLastColumn As Integer

' Get the filename & location of the picture
szPicFileName = Application.GetOpenFilename()
On Error Resume Next
Set pic = ActiveSheet.Pictures.Insert(szPicFileName)
On Error GoTo 0
If Not pic Is Nothing Then 'Found it!'
' Set the range (change the first & last columns & rows to whatever you need)
rFirstRow = 113
rLastRow = 135
cFirstColumn = 2
cLastColumn = 18
Set Rng = Range(Cells(rFirstRow, cFirstColumn), Cells(rLastRow, cLastColumn))
With pic
.Height = Rng.Height
.Width = Rng.Width
.Left = Rng.Left
.Top = Rng.Top
End With
End If


'Increment the picture number by 1 and save the inserted picture name

Range("AZ197") = Range("AZ197") + 1
Range("IN196").Select
Range("IN197").Select
Selection.Copy
Range("IN193").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False


Which successfully inserts a picture, but the naming is still not working.

Any help would be much appreciated