VBscript question

Jeff1959

Junior Member
Mar 11, 2013
1
0
0
I have been trying to build an outlook form that will print what you see and came across this Microsoft vbscript solution. I would like to be able to set the screen capture pasted picture to a specific size when pasted into the word document. If anyone could help that would be great.

Best regards

Code:
   Sub cmdPrint_Click()
dim oDoc
dim oPS


   Set oWordApp = CreateObject("Word.Application")
   If oWordApp Is Nothing Then
      MsgBox "Couldn't start Word."
   Else
      Dim oWordApp
      Dim oWordDoc
      Dim oBMs
      Dim bolPrintBackground

      ' Open a new document.
      Set oDoc = oWordApp.Documents.Add

      ' Set a page setup object variable.
      Set oPS = oDoc.PageSetup

      ' Reduce the margins to .5" (36 points).
      oPS.TopMargin = 36
      oPS.BottomMargin = 36
      oPS.LeftMargin = 36
      oPS.RightMargin = 36

Const wdOrientLandscape = 1

oPS.Orientation = wdOrientLandscape



      ' Paste in the screen shot.
      oWordApp.Selection.Paste

      ' Center the screen shot.
      Const wdAlignParagraphCenter = 1
      oDoc.Paragraphs(1).Alignment = wdAlignParagraphCenter

      ' Get the current Word setting for background printing.
      bolPrintBackground = oWordApp.Options.PrintBackground

      ' Turn background printing off.
      oWordApp.Options.PrintBackground = False

      ' Print the Word document.
      oDoc.PrintOut

      ' Restore previous setting.
      oWordApp.Options.PrintBackground = bolPrintBackground

      ' Close and do not save changes to the document.
      Const wdDoNotSaveChanges = 0
      oDoc.Close wdDoNotSaveChanges

      ' Close the Word instance.
      oWordApp.Quit

      ' Clean up.
      Set oPS = Nothing
      Set oDoc = Nothing
      Set oWordApp = Nothing
   End If


End Sub