Someday when I’m using my excel2003, I need print preview without exiting userfom, hereis my codes :
Dim isOver As Boolean
Dim isinit As Boolean
Private Sub CommandButton1_Click()
Unload Me
End Sub
Private Sub CommandButton2_Click()
FrmPrinter.Show
End Sub
Private Sub ScrollBar1_Change()
Image1.Top = -ScrollBar1
Image2.Top = -ScrollBar1 – 18
End Sub
Private Sub ScrollBar1_Scroll()
ScrollBar1_Change
ScrollBar2_Change
Label1.Caption = ScrollBar1 & “:” & ScrollBar2
End Sub
Private Sub ScrollBar2_Change()
Image1.Left = -ScrollBar2
Image2.Left = -ScrollBar2 – 18
Label1.Caption = ScrollBar1 & “:” & ScrollBar2
End Sub
Private Sub Slider1_Change()
Dim FZoom
FZoom = Split(“100,125,135,145,160,175,180,190,210,225,275″, “,”)
Frame1.Zoom = FZoom(Slider1)
ScrollBar1.Min = -FZoom(Slider1) + FZoom(Slider1) – 35
ScrollBar2.Min = -FZoom(Slider1)
ScrollBar1.Max = FZoom(Slider1) + 100
ScrollBar2.Max = FZoom(Slider1)
End Sub

Private Sub UserForm_activate()
If Not isinit Then Exit Sub
If Left(ThisWorkbook.Sheets(“SIform”).Range(“d55″), 1) = “0″ Then
ThisWorkbook.Sheets(“SIform”).Shapes(“CANCEL”).Visible = True
Else
ThisWorkbook.Sheets(“SIform”).Shapes(“CANCEL”).Visible = False
End If
Dim Hwnd As Long
Hwnd = FindWindow(vbNullString, Caption)
ShowWindow Hwnd, 0
SetWindowLong Hwnd, -20, &H40101
ShowWindow Hwnd, 1
SendMessage Hwnd, WM_SYSCOMMAND, SC_MAXIMIZE, 0
Application.ScreenUpdating = True
Slider1_Change
ScrollBar1 = ScrollBar1.Min
Dim Pct As Long
Pct = IIf(Application.Version > 9, xlPicture, xlBitmap)
ThisWorkbook.Sheets(“SIForm”).Range(“A1:n75″).CopyPicture xlScreen, Pct
Image1.Picture = PastePicture(Pct)
End Sub
Private Sub UserForm_Initialize()
isinit = True
Width = 766.5
SetWindowLong FindWindow(vbNullString, Caption), -16, &HCF0000
End Sub
Private Sub UserForm_Resize()
On Error Resume Next
Frame2.Width = InsideWidth + 1
Frame1.Width = InsideWidth – ScrollBar1.Width
Frame1.Height = InsideHeight – Frame2.Height – ScrollBar2.Height
Frame2.Top = InsideHeight – Frame2.Height
ScrollBar1.Left = InsideWidth – ScrollBar1.Width
ScrollBar1.Height = Frame1.Height
ScrollBar2.Top = Frame1.Height
ScrollBar2.Width = InsideWidth – ScrollBar1.Width
‘Image1.Left = (Frame1.Width – Image1.Width) / 2
‘Image2.Left = Image1.Left – 18
ScrollBar1_Change
ScrollBar2_Change
End Sub
Private Sub UserForm_Terminate()
Call ShpHome
Image1.Picture = Nothing
UserForm4.Show
UserForm4.isinit = True
‘ SelItem.Selected = True
End Sub
Recent Comments