0

I am trying to make macro for cropping website and paste it to powerpoint using tinytask, but failed

  1. login to site.
  2. crop the page.(any tool eg.snipping tool).
  3. paste it to powerpoint slide.
  4. Resize the image.

I need to crop so many thing from website and to paste in powerpoint.

Eg: 1)I login to superuser website

2)Cropping the website click here

3)Paste it in powerpoint click here

4)Resize

1
  • But what step is not working with TinyTask? Aug 16, 2020 at 18:48

2 Answers 2

0

This is not a feasible operation.

VBA can call the system screen capture tool, but we can't control the screen capture tool in the web page and paste it into ppt.

0

While it may not be feasible to perform the whole operation from VBA, something like this will eliminate most of the tedium. You manually make the screenshot, then invoke the macro to add a new slide to the current presentation, paste in the screenshot, format it, add a title and so on:

Option Explicit

' Edit these as required:
Const lLayoutType As Long = 6   ' 6=TitleOnly, 7=Blank
Const lFontSize As Long = 16    ' Font size of slide title, if any
Const sngCropTop As Single = 142

Sub PasteMap()
' Assumes map has been Alt+PrtScreen'ed from a fullscreen window in Chrome
' from Google Maps

    Dim oSl As Slide
    Dim oSh As Shape
    Dim sTemp As String
    
    sTemp = "Type title here"
    
    With ActivePresentation
        ' add a new slide
        Set oSl = .Slides.AddSlide(.Slides.Count + 1, .Designs(1).SlideMaster.CustomLayouts(lLayoutType))
        
        ' paste in the screenshot
        Set oSh = oSl.Shapes.Paste(1)
        
        ' format the pasted screenshot:
        With oSh
            ' prevent it from being distorted by size changes
            .LockAspectRatio = True
            
            ' set it to the width of the slide
            .Width = ActivePresentation.PageSetup.SlideWidth
            
            ' crop off the top by a pre-determined amount (see beginning of code)
            .PictureFormat.CropTop = sngCropTop
            
            ' move it to the left of the slide
            .Left = 0
            
            ' position it appropriately from top of slide
            .Top = ActivePresentation.PageSetup.SlideHeight - .Height
            
        End With
        
        ' get a title for the map, set and position the title
        On Error Resume Next    ' won't work if no title in the layout!
        Set oSh = oSl.Shapes(1) ' the title
        oSh.Top = 5
        oSh.TextFrame.VerticalAnchor = msoAnchorTop
        With oSh.TextFrame.TextRange
            .Font.Size = lFontSize
            sTemp = InputBox("Page title:", "Page title", sTemp)
            If Len(sTemp) > 0 Then
                .Text = sTemp
            End If
        End With
        
    End With
    
End Sub

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .