|
-
January 15th, 1999, 05:24 PM
#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
-
June 15th, 1999, 02:07 PM
#2
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|