×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VIEW doc word in form but at 70% not 100%

VIEW doc word in form but at 70% not 100%

RE: VIEW doc word in form but at 70% not 100%

You have set the Zoom property, path: Document>Window>View>Zoom. VB code here.

combo

RE: VIEW doc word in form but at 70% not 100%

>need to show in form

How are you currently showing "in form"?

RE: VIEW doc word in form but at 70% not 100%

No idea!
(Sal21)

RE: VIEW doc word in form but at 70% not 100%

So, let's break this down. Your primary question is:

How do I show a Word document on a VB6 form?

Is that correct?

RE: VIEW doc word in form but at 70% not 100%

Yes

RE: VIEW doc word in form but at 70% not 100%

You may find this useful.

combo

RE: VIEW doc word in form but at 70% not 100%

Drop an OLE container control onto the form. Click 'Canc el' in the resulting Insert Object dialog.

Then in code you can open any word doc you like as follows:

OLE1.CreateEmbed "pathtomyfile", "Word.Document"

And that's pretty much it.

You can then access and automate the word document via OLE1.Object

(one challenge with this is your next requirement - zooming out - as the Zoom method suggested by combo doesn't work with the window shown by the OLE control)

RE: VIEW doc word in form but at 70% not 100%

>Zoom method ... doesn't work

I think I may have a solution to the Zoom issue. Quick question before I put the effort in to an example - are you just using wanting to VIEW the Word document, not interact with it to edit etc?

RE: VIEW doc word in form but at 70% not 100%

not interact with it to edit etc!
Only show It, lock It for edit.

RE: VIEW doc word in form but at 70% not 100%

Ok .. in that case I've got a basic Proof of Concept working. just need a tiny tidy up before posting.

RE: VIEW doc word in form but at 70% not 100%

As usual tks!

RE: VIEW doc word in form but at 70% not 100%

OK, enough teasing ...

You will need a form with:
a) Picturebox which will host our zoomed view control (which is also a picturebox). Call it OLEProxieHost. Give itr a different colour background (i use the Application Workspace colour, )
b) Another picturebox, placed inside the first picturebox; call it OLEProxieView
c) horizontal scrollbar
d) A label
e) an OLE control, hidden (either visibility set to none, or outside the form borders (feel free to leave this with default name, OLE1)

Note I only use OLEProxieHost as a cheap way to restrict the zoom limits of the OLEProxieView. It is not a criotical part of the idea

And then copy and paste this code into your form module:

CODE -->

Option Explicit

Private myscale As Single

Private Sub Form_Load()
    OLE1.SizeMode = vbOLESizeAutoSize ' ensures we have an enhanced metafile picture in the OLE container
    OLE1.CreateEmbed "f:\testing.docx", "Word.application" ' Here is where we load our word doc
    OLEZoom = 75 ' initial zoom %
End Sub

Private Sub OLEZoom_Change()
    Label1.Caption = Format(OLEZoom / 100, "0%")
    DrawOLEView
End Sub

Public Sub DrawOLEView()
    myscale = OLEZoom / 100
    OLEProxieView.Width = OLE1.Picture.Width * ScaleX(1, 8, 1) * myscale
    OLEProxieView.Height = OLE1.Picture.Height * ScaleY(1, 8, 1) * myscale
    OLEProxieView.AutoRedraw = True
    OLEProxieView.Cls
    ' This is the line that does all the hard work
    OLE1.Picture.Render OLEProxieView.hDC, 0, 0, OLE1.Picture.Width * ScaleX(1, 8, 3) * myscale, OLE1.Picture.Height * ScaleY(1, 8, 3) * myscale, 0, OLE1.Picture.Height, OLE1.Picture.Width, -OLE1.Picture.Height, 0&
    OLEProxieView.AutoRedraw = False
    OLEProxieView.Refresh
End Sub 

Altrernatively, just try this zipped vb6 project



RE: VIEW doc word in form but at 70% not 100%

(OP)
strongm!!!!
Tks work perfect!

RE: VIEW doc word in form but at 70% not 100%

Have you considered issuing a purple star 9'great Popst') to any of your recent threads, such as

thread222-1816156: VIEW doc word in form but at 70% not 100%
thread222-1816151: How can i get the Column Index and the Row Index when I click on the ListView?
thread222-1816138: clipbord strting from item in lisview
thread222-1814392: to be sure sequence of code in form
thread222-1813872: ctooltip class tooltip baLloon in msflexgrid

This not only encourages those who have helped you to help you again in the future, but also makes it easier for future visitors with similar questions to identify threads that might help them

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close