title: Place images of each multipage page into worksheet programmatically
body: <p>I have an Excel userform with a Multipage control containing currently 9 pages. Each page has assembly information for a particular component with dimensions entered by the user. I have an image inserted on each page showing the design of each component and text boxes on top of the image which the user inputs custom dimensions for production calculations.  All I want to do is create files of the images based on a specific naming structure that can be linked to multiple cells in Excel.  For instance, I would like when the user saves the userform, for images of each multipage view to be named and placed into specific cells on a sheet.  The names should correspond to a unique ID I'm using with a suffix so I can switch between projects on my project page and the images for each component will change based on the name.  I have the project page set up and can handle the switch, what I need help on is cycling through the multipage pages, creating image files of a portion of each page and saving to a location. </p>
  
  <p>Thank you for your help!</p>
  
  <pre><code>Option Explicit
  
  Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
  ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
  Const VK_SNAPSHOT = 44
  Const VK_LMENU = 164
  Const KEYEVENTF_KEYUP = 2
  Const KEYEVENTF_EXTENDEDKEY = 1
  
  
  Private Sub CommandButton2_Click()
    Dim pdfName As String
  
    keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY, 0
    keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY, 0
    keybd_event VK_SNAPSHOT, 0, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
    keybd_event VK_LMENU, 0, KEYEVENTF_EXTENDEDKEY + KEYEVENTF_KEYUP, 0
  
    DoEvents  'Otherwise, all of screen would be pasted as if PrtScn rather than Alt+PrtScn was used for the copy.
  
    ThisWorkbook.Worksheets.Add After:=Worksheets(Worksheets.Count)
    ActiveSheet.PasteSpecial Format:="Bitmap", Link:=False, DisplayAsIcon:=False
  
    pdfName = ActiveWorkbook.Path &amp; "\" &amp; Me.Name &amp; " " &amp; Format(Now, "yyyy-mmm-dd") &amp; ".pdf"
    'Debug.Print pdfName
    ActiveSheet.ExportAsFixedFormat _
      Type:=xlTypePDF, _
      Filename:=pdfName, _
      Quality:=xlQualityStandard, _
      IncludeDocProperties:=False, _
      IgnorePrintAreas:=False, _
      OpenAfterPublish:=False
  
    Worksheets(Worksheets.Count).Delete
  
    Unload Me
  End Sub
  </code></pre>