Results 1 to 7 of 7

Thread: [RESOLVED] Ole container question - display problem

  1. #1

    Thread Starter
    Addicted Member habenero's Avatar
    Join Date
    Aug 2015
    Posts
    224

    Resolved [RESOLVED] Ole container question - display problem

    I'm still trying to get an Ole container to display the desired range (excel 2000 workbook/worksheet)

    I can get the container to display part of the range but it is not complete

    I've even went into the workbook\worksheet itself to set a print range with no effect

    It clips two or three columns Short and 7 rows short. I googled this problem to no real solution

    It seems to be either with excel or the container itself? Do I need to set a range before I display the container?

    Jeff

  2. #2
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Ole container question - display problem

    Hi Habenero,

    It sounds like you need to study up on the ScrollIntoView, ScrollColumn, ScrollRow, and VisibleRange methods of the Excel VBA object model.

    Regards,
    Elroy

    p.s. And with what I gave you here, you should be able to work it out.
    Last edited by Elroy; Feb 5th, 2017 at 02:43 PM.
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  3. #3

    Thread Starter
    Addicted Member habenero's Avatar
    Join Date
    Aug 2015
    Posts
    224

    Re: Ole container question - display problem

    will investigate it for sure - don't know what scroll view and all that will do for me

    You see the container is large enough to display the ranges that I need to see

    here are the properties for the container:

    VERSION 5.00
    Begin VB.Form frm_sheet_viewer
    ClientHeight = 7785
    ClientLeft = 60
    ClientTop = 345
    ClientWidth = 10140
    LinkTopic = "Form2"
    ScaleHeight = 7785
    ScaleWidth = 10140
    StartUpPosition = 3 'Windows Default
    Begin VB.CommandButton cmd_get_wbk
    Caption = "&Display Workbook"
    Height = 495
    Left = 120
    TabIndex = 3
    Top = 6480
    Width = 1575
    End
    Begin VB.CommandButton cmd_view_sheet
    Caption = "&View Sheet"
    Height = 495
    Left = 120
    TabIndex = 2
    Top = 7080
    Width = 1575
    End
    Begin VB.CommandButton cmd_exit
    Caption = "&Exit"
    Height = 495
    Left = 8400
    TabIndex = 0
    Top = 6840
    Width = 1575
    End
    Begin VB.Label Label1
    BeginProperty Font
    Name = "MS Sans Serif"
    Size = 9.75
    Charset = 0
    Weight = 700
    Underline = 0 'False
    Italic = 0 'False
    Strikethrough = 0 'False
    EndProperty
    Height = 495
    Left = 2040
    TabIndex = 4
    Top = 6480
    Width = 1815
    End

    But again thanks for the reply and helpful hint

    Jeff


    PS My range desired to view is A1 to J15 with col width at 8.5 and row height at 12.5
    Last edited by habenero; Feb 6th, 2017 at 11:49 AM. Reason: more info

  4. #4
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    9,853

    Re: Ole container question - display problem

    Hi habenero,

    I guess I don't understand. From your original post, it sounded like you were having trouble getting a certain range to appear in your OLE control's window. I can think of three reasons that would be happening:

    1) The correct worksheet (tab) isn't showing.
    2) The range isn't scrolled (either vertically or horizontally) to the correct position.
    3) The RowHeight and/or ColumnWidth for the range it too large.

    We solved #1 in the previous thread.

    We solved #2 with the above mention of ScrollIntoView, ScrollColumn, ScrollRow, and VisibleRange.

    And, to solve #3, you could take a look at the ColumnWidth and/or RowHeight properties of the Range object.

    If one of these isn't the answer, then I guess I truly don't understand.

    Also, truth be told, even though you're getting there through the OLE control, this is really a VBA discussion. The issues are precisely the same regardless of whether you're viewing Excel through an OLE control or just looking at Excel through an open copy of the Excel program. You can just think of the OLE control as an alternative place to open Excel (as opposed to the desktop window).

    Good Luck,
    Elroy
    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

  5. #5

    Thread Starter
    Addicted Member habenero's Avatar
    Join Date
    Aug 2015
    Posts
    224

    Re: Ole container question - display problem

    Thanks again for the reply and help I really do appreciate it

    here is a pic of the ole container and what I am getting to display

    I was a bit unsure where I'd would be looking for a solution (either in VBA or here in the VB6 world)

    All I want is a full sheet displayed (gridlines and all other data)

    Jeff

    PS I started a new project - inserted OLE cont; then I went to the desired workbook - selected a sheet and then saved the workbook. Then went to the sourcedoc property and I get the desired display - all is good

    Maybe I need to open the wb - select the desired sheet - then save - then in code re-specify the sourcedoc property..
    Does this sound strange?
    Attached Files Attached Files
    Last edited by habenero; Feb 6th, 2017 at 02:57 PM. Reason: clarity - more info

  6. #6

    Thread Starter
    Addicted Member habenero's Avatar
    Join Date
    Aug 2015
    Posts
    224

    Re: Ole container question - display problem

    this whole thing must be a run-time vs design time setting

  7. #7

    Thread Starter
    Addicted Member habenero's Avatar
    Join Date
    Aug 2015
    Posts
    224

    Re: [RESOLVED] Ole container question - display problem

    a follow up

    It was what I suspected

    In one form I start excel ; then build the reference to the workbook ; activate the worksheet and then save the workbook

    Using a command button I reference the sourcedoc property in the OLE container (on another form) to null ; then use this magic line "ole_sheet_viewer.InsertObjDlg" to select the saved workbook and the container appears on the form with the sheet/workbook desired

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width