Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.87 KB | None | 0 0
  1. Sub SubSlide4(wsKAP As Worksheet, RangeArray As Variant)
  2. Dim iSlide As Long
  3. Dim rngVW As Variant
  4. Dim fullNameVW As String
  5. Dim ErrorCount4 As Long
  6.  
  7. iSlide = 4
  8. ErrorCount4 = 0
  9. For Each rngVW In RangeArray 'RangeArray has ~10 members
  10.  
  11. 'Paste correct data for each VW
  12. wsKAP.Range(rngVW).Copy
  13. wsKAP.Range("tab.StartHeader").PasteSpecial Paste:=xlPasteValues
  14. fullNameVW = "Test"
  15. wsKAP.Range("C73") = fullNameVW
  16.  
  17. Set mySlide = myPresentation.Slides(iSlide)
  18.  
  19. 'Copying Overview
  20. Set rng = wsKAP.Range("C89:P97")
  21. rng.Copy
  22. DoEvents
  23. mySlide.Shapes.PasteSpecial DataType:=ppPasteEnhancedMetafile
  24. Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
  25. With myShape
  26. .Left = 20
  27. .Top = 71
  28. .Height = 92
  29. End With
  30.  
  31. 'Copying Charts
  32. RepeatOnError2: '<-----------------------------------------------------
  33. Set rng = wsKAP.Range("A30:Y69")
  34. rng.Copy
  35. DoEvents
  36. On Error GoTo ErrorHandler '<-----------------------------------
  37. mySlide.Shapes.PasteSpecial DataType:=ppPasteEnhancedMetafile
  38. Set myShape = mySlide.Shapes(mySlide.Shapes.Count)
  39. With myShape
  40. .Left = 20
  41. .Top = 187
  42. .Width = 686
  43. End With
  44. iSlide = iSlide + 1
  45. Application.CutCopyMode = False
  46. Next rngVW
  47.  
  48. ErrorHandler: '<----------------------------------------------------------
  49. If Err.Number = -2147188160 Then
  50. If ErrorCount4 > 20 Then
  51. MsgBox "Too many errors (-2147188160), canceling"
  52. End
  53. End If
  54.  
  55. ErrorCount4 = ErrorCount4 + 1
  56. Debug.Print "ErrorCount4 is " & ErrorCount4
  57. Resume RepeatOnError2 '<-----------------------------------------
  58. End If
  59. On Error GoTo 0
  60. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement