• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 777
  • Last Modified:

OLE object scrolling

I have an OLE object that containes a linked Excel spreadsheet (OLE1.sourcedoc = C:\stoplight.xls).  When I display the form containing the OLE object my spreadsheet is loaded just fine but I am unable to scroll down to see all the data.  All I want to do is scroll the data in the OLE window.  I want my program form to remain visible.  I tried to add a vscroll control to my form but it scrolls the OLE object window off the screen.  I just cant seem to figure out how to anchor the OLE window and scrool the data.
0
clarwc
Asked:
clarwc
  • 6
  • 5
  • 2
  • +1
1 Solution
 
anthonycCommented:
You can set it up by:

1)  Setting the OLE control to autosize, making it the entire size of the document.

2)  Add a Vertical (and horizontal) scrollbar, both going from 0 to the height (or width) of the OLE control

3)  On the change event of the vertical (or horizontal) scrollbar, put code like this

OLE1.move -1 * hscroll1.value, -1 * vscroll1.value

which will move the control around.. or give the appearance of that anyway.  Set the LargeChange value to the height/width of the form.

Anthony
0
 
clarwcAuthor Commented:
Anthonyc

Thanks for the suggestion.  I am VERY new to programming and self taught too....

The suggestion you gave won't work for me because I have controls on the bottom of the form that need to be available.  for this reason I need to leave the window at it's current height and scroll the data within the window...

Any Ideas???
0
 
anthonycCommented:
yes.

Put the OLE control inside a picture box.  A Flat picturebox that has the same backcolor as the form.  Then do the same things I mentioned above, but using picturebox dimensions.  You can size the picturebox to any size you'd like.

Anthony
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
clarwcAuthor Commented:
I need just to scrool up and down in the box.  I tried to use

OLE1.move -1 vscroll1.value

But that scrolled it side to side.  I will try the picturebox but can you tell me the code for moving the object up and down???

Thanks...

Warren
0
 
clarwcAuthor Commented:
What do you mean by Put the OLE control inside a picture box.  

Do I set a property of the picture box?  How do I get the OLE object inside the picturebox?  Sorry if these are very basic kinds of questions.



0
 
clarwcAuthor Commented:
Got the picture box and OLE working and it looks good but I can't get the scroll to go up and down....
0
 
Jason_GCommented:
Hi clarwc,
It seems you have a pesky little problem on your hands.  I found out how to do implement scrollbars when embedding a Word document, as shown below.

1. Start Visual Basic; Form1 is created by default.

2. Add an OLE container control to Form1 (Ole1 is the default name for the control).

3. The insert object dialog box should appear after you draw the OLE container control on the form. Choose Create from the File option, and choose an existing Word .DOC file that is more than a page in length. The "Link" and "Display As Icon" check boxes should not be selected. Choose the OK button when you are done; the document should now be embedded in the OLE container control.

4. Add a VScrollBar button to Form1 (SpinButton1 is the default name of the control).

5. Place the following code in the UpDown1_DownClick event:

Private Sub UpDown1_DownClick()
If OLE1.AppIsRunning Then
OLE1.Object.Application.WordBasic.VLine -1
         Else
         OLE1.Action = 7        'Activate
End If
End Sub

6. Place the following code in the UpDown1_UpClick event.

Private Sub UpDown1_UpClick()
If OLE1.AppIsRunning Then
OLE1.Object.Application.WordBasic.VLine 1
     Else
         OLE1.Action = 7           'Activate
End If
End Sub

7. Save the project.

8. Run the application.

9. Double-click the OLE control to activate the Word .DOC object for visual editing.

10.Press the VScrollBar button to scroll up and down the document.

I know you wanted this for Excel, but I haven't had time to look into it yet.  I'm sure it is nearly identical, and if I find the solution for it I will send you the code, however, this should put you on the right track.

I hope this helps.

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
http://scholars.com
0
 
Jason_GCommented:
Hi clarwc,
Sorry, a little mistake in step 4, where you see spinbutton1, replace that with UpDown1.  I had to convert the code from VB4.0 which used spinbuttons to VB5.0, and got a little mixed up when writing it down.

Good luck.

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
http://scholars.com
0
 
clarwcAuthor Commented:
Jason,

Thanks for the code...I would like to figure out a way to split the points between you and Anthony.....Any suggestions???
0
 
Jason_GCommented:
Hi clarwc,
Well, I've had this happen to me before where a user wants to split points between myself and another expert, and usually there is a lady who does customer service for Experts.com who has the username linda.  I'm not exactly sure how to contact her, but I think she will contact you.

All she did was post questions to each of us, with the subject, question for Jason_G and question for OtherExpert.

If you make a post for no points requesting her assistance she will help you, although she may contact you just from this post.

Also, since I've never posted a question, I'm not sure exactly how it works, but you could always withdraw your points, and post 2 new questions in the manner I mentioned above, and then award the points to us when we reply.

I hope I helped.

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
http://scholars.com
0
 
Jason_GCommented:
Hi clarwc,
I found what you need to do, you simply go here, and post that you want to split your points between 2 experts.
http://www.experts-exchange.com/browsing/experts-exchange/

I hope this helps.

Also, thank you for the points.

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
http://scholars.com
0
 
linda101698Commented:
On this question, I suggest that you have JasonG post an answer and grade the question awarding him the points.  I'll post another question to award anthonyc some points.

anthonyc,
Look for the question in the unanswered questions directed to you.

Jason_G,
Post an answer so the question can be graded.

Linda Gardner
Customer Service @ Experts Exchange
0
 
Jason_GCommented:
Hi Linda and clarwc,
Just responding to your comments, to receive my points.

Thanks,

Sincerely,
Jason

Jason Gorman (jason_gorman@scholars.com)
Learning Advisor, scholars.com
Microsoft Authorized Technical Education Center
Novell Authorized Online Training Provider
http://scholars.com
0
 
clarwcAuthor Commented:
Thanks for the help...

sorry it took so long for me to award the points...

Warren
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 6
  • 5
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now