ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

¤@­Ó¦C¦L°ÝÃD½Ð¨D¨ó§U

¥Î2003ª©¼g¤@­Ó, ¦Û¦æ®M¬Ý¬Ý:
  1. Private Sub CommandButton1_Click()
  2. If TextBox1 = "" Then Exit Sub
  3. [B1] = TextBox1
  4. With [B2]
  5.      .Formula = "=VLOOKUP(B1,'" & ThisWorkbook.Path & "\[¸ê®Æ®w.xls]­û¤u¸ê®Æªí'!$A:$B,2,)"
  6.      .Value = .Value
  7. End With
  8. If IsError([B2]) Then
  9.     MsgBox "§ä¤£¨ì²Å¦Xªº©m¦W¡I¡@": [B1:B2] = "": Exit Sub
  10. Else
  11.    Unload Me
  12.    [A1:L48].Name = ActiveSheet.Name & "!Print_Area"
  13.    ActiveSheet.PrintOut
  14. End If
  15. End Sub
½Æ»s¥N½X


mm01.rar (21.65 KB)

TOP

¦^´_ 4# 317


­n´X­Óµ{§Ç:
¼Ò²Õ°Ï:
Public PrntChk%

Sub Macro1()
PrntChk = 1 '¦C¦L±±¨î½X
UserForm1.Show
End Sub

¬¡­¶Ã¯/µ{§Ç°Ï:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "¤u§@ªí1" Then
  If PrntChk <> 1 Then Cancel = True
End If
End Sub

FORMªí³æ°Ï:
Private Sub CommandButton1_Click()
If TextBox1 = "" Then Exit Sub
[B1] = TextBox1
With [B2]
     .Formula = "=VLOOKUP(B1,'" & ThisWorkbook.Path & "\[¸ê®Æ®w.xls]­û¤u¸ê®Æªí'!$A:$B,2,)"
     .Value = .Value
End With
If IsError([B2]) Then
    MsgBox "§ä¤£¨ì²Å¦Xªº©m¦W¡I¡@": [B1:B2] = "": Exit Sub
Else
   [A1:L48].Name = ActiveSheet.Name & "!Print_Area"
   ActiveSheet.PrintOut
   Unload Me
End If
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
PrntChk = 0
End Sub

mm02.rar (23.25 KB)

TOP

¦^´_ 7# hong912


¦A¥[­ÓÅܼƧY¥i:
mm03.rar (23.52 KB)

TOP

        ÀR«ä¦Û¦b : ¤f»¡¦n¸Ü¡B¤ß·Q¦n·N¡B¨­¦æ¦n¨Æ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD