Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

OLE object scrolling

Posted on 1998-07-14
14
Medium Priority
?
732 Views
Last Modified: 2013-11-25
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
Comment
Question by:clarwc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
  • 2
  • +1
14 Comments
 
LVL 6

Expert Comment

by:anthonyc
ID: 1465699
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
 

Author Comment

by:clarwc
ID: 1465700
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
 
LVL 6

Expert Comment

by:anthonyc
ID: 1465701
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:clarwc
ID: 1465702
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
 

Author Comment

by:clarwc
ID: 1465703
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
 

Author Comment

by:clarwc
ID: 1465704
Got the picture box and OLE working and it looks good but I can't get the scroll to go up and down....
0
 
LVL 1

Expert Comment

by:Jason_G
ID: 1465705
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
 
LVL 1

Expert Comment

by:Jason_G
ID: 1465706
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
 

Author Comment

by:clarwc
ID: 1465707
Jason,

Thanks for the code...I would like to figure out a way to split the points between you and Anthony.....Any suggestions???
0
 
LVL 1

Expert Comment

by:Jason_G
ID: 1465708
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
 
LVL 1

Expert Comment

by:Jason_G
ID: 1465709
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
 
LVL 7

Expert Comment

by:linda101698
ID: 1465710
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
 
LVL 1

Accepted Solution

by:
Jason_G earned 800 total points
ID: 1465711
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
 

Author Comment

by:clarwc
ID: 1465712
Thanks for the help...

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

Warren
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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

597 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