[Webinar] Streamline your web hosting managementRegister Today


VB Screen to Word

Posted on 2000-01-17
Medium Priority
Last Modified: 2010-05-02
I need to include some VB form images into Word.  I can clipboard them, but that grabs the whole screen, makes the document huge, and the image has to be cropped each time to remove the extra desktop image.  

I am wondering if there's another tool that's easier and more flexible to work with.

Question by:gglover

Accepted Solution

tward earned 200 total points
ID: 2359687
A program called SnagIt will allow you to simply capture certain windows:


Or this code will capture a Form in your vb project:

Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long

Public Const SRCCOPY = &HCC0020
Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long

  Dim ScreenHandle As Long
  Const NEWFRAME = 1
  Const PIXEL = 3
  '* StretchBlt requires pixel coordinates.
  Picture1.ScaleMode = PIXEL
  Printer.ScaleMode = PIXEL
  Form1.ScaleMode = PIXEL
  ScreenHandle = Form1.hwnd
  apierror& = StretchBlt(Picture1.hdc, Picture1.ScaleLeft, Picture1.ScaleTop, 10000, 9350, GetDC(ScreenHandle), 0, 0, Form1.Width, Form1.Height, SRCCOPY)
  Picture1.Picture = Picture1.Image
LVL 26

Expert Comment

ID: 2360258
You can only capture the current window by pressing ALT-PrintScreen twice.

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

613 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question