CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 1999
    Posts
    1

    Embedding Excel Sheet in VB



    Hi,

    I am currently trying to embed an Excel sheet in a VB app. No problems there. I essentially place an OLE container on the form and set the class to an excel sheet. The trouble comes when I resize the form (MDIChild window). The container apparently resizes OK, but the Excel sheet does not!!! Any help would be great as this is driving me mad!!!


    Many Thanks


    Nick



  2. #2
    Join Date
    Jun 1999
    Posts
    26

    Re: Embedding Excel Sheet in VB

    Try the following...

    Use this function to get scroll bar thickness..

    Public Declare Function GetSystemMetrics Lib "user32" (ByVal nIndex As Long) As Long
    Public Const SM_CXVSCROLL = 2
    Public Const SM_CYHSCROLL = 3
    Public Const SM_CYVSCROLL = 20
    Public Const SM_CXHSCROLL = 21


    This is the code to resize...


    private Sub Form_Resize()
    If Not (frmViewGraphics.WindowState = vbMinimized) then

    ' Resize the Ole control accounting for scrollbar thickness
    '
    OLEView.Width = frmView.ScaleWidth - GetSystemMetrics(SM_CXVSCROLL) * Screen.TwipsPerPixelX
    OLEView.Height = frmView.ScaleHeight - GetSystemMetrics(SM_CYHSCROLL) * Screen.TwipsPerPixelY
    End If
    End Sub







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

Featured