Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. =getImageQaulidade(1) 'e nessa celula ficava a imagem.
  2.  
  3. Function getImageQaulidade(x As Integer) As Object
  4. 'InsertPictureInRange "C:FolderNamePictureFileName.gif", _
  5. ' Range("B5:D10")
  6. 'InsertPictureInRange "C:UsersFolderNameDOCUME~1Imagem1.jpg", _
  7. ' Range("B5:D30")
  8. Dim LNumber As Integer
  9.  
  10. LNumber = x
  11.  
  12. Select Case LNumber
  13. Case Is = 1
  14. Dim aux As Object
  15. aux = InsertPictureInRange("C:UsersFolderNameDOCUME~11.png")
  16. Set TestInsertPictureInRange = aux
  17. Case Is = 2
  18. Set TestInsertPictureInRange = InsertPictureInRange("C:UsersFolderNameDOCUME~12.png")
  19. Case Is = 3
  20. Set TestInsertPictureInRange = InsertPictureInRange("C:UsersFolderNameDOCUME~13.png")
  21. Case Else
  22. MsgBox "numero não existe"
  23.  
  24. End Select
  25.  
  26. End Function
  27.  
  28. Function InsertPictureInRange(PictureFileName As String) As Object
  29. ' inserts a picture and resizes it to fit the TargetCells range
  30. Dim p As Object, t As Double, l As Double, w As Double, h As Double
  31. If TypeName(ActiveSheet) <> "Worksheet" Then Exit Function
  32. If Dir(PictureFileName) = "" Then Exit Function
  33. ' import picture
  34. Set p = ActiveSheet.Pictures.Insert(PictureFileName)
  35. With p
  36. .Top = t
  37. .Left = l
  38. .Width = w
  39. .Height = h
  40. End With
  41. InsertPictureInRange = p
  42. Set p = Nothing
  43. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement