Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- =getImageQaulidade(1) 'e nessa celula ficava a imagem.
- Function getImageQaulidade(x As Integer) As Object
- 'InsertPictureInRange "C:FolderNamePictureFileName.gif", _
- ' Range("B5:D10")
- 'InsertPictureInRange "C:UsersFolderNameDOCUME~1Imagem1.jpg", _
- ' Range("B5:D30")
- Dim LNumber As Integer
- LNumber = x
- Select Case LNumber
- Case Is = 1
- Dim aux As Object
- aux = InsertPictureInRange("C:UsersFolderNameDOCUME~11.png")
- Set TestInsertPictureInRange = aux
- Case Is = 2
- Set TestInsertPictureInRange = InsertPictureInRange("C:UsersFolderNameDOCUME~12.png")
- Case Is = 3
- Set TestInsertPictureInRange = InsertPictureInRange("C:UsersFolderNameDOCUME~13.png")
- Case Else
- MsgBox "numero não existe"
- End Select
- End Function
- Function InsertPictureInRange(PictureFileName As String) As Object
- ' inserts a picture and resizes it to fit the TargetCells range
- Dim p As Object, t As Double, l As Double, w As Double, h As Double
- If TypeName(ActiveSheet) <> "Worksheet" Then Exit Function
- If Dir(PictureFileName) = "" Then Exit Function
- ' import picture
- Set p = ActiveSheet.Pictures.Insert(PictureFileName)
- With p
- .Top = t
- .Left = l
- .Width = w
- .Height = h
- End With
- InsertPictureInRange = p
- Set p = Nothing
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement