- ©«¤l
- 522
- ¥DÃD
- 36
- ºëµØ
- 1
- ¿n¤À
- 603
- ÂI¦W
- 0
- §@·~¨t²Î
- win xp sp3
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-12-13
- ³Ì«áµn¿ý
- 2021-7-11
|
¥»©«³Ì«á¥Ñ yen956 ©ó 2014-4-8 13:32 ½s¿è
¦^´_ 5# gn00713242
ªá¤F¤@¾ã©]ªº´ú¸Õ»Pקï, ²×©ó§¹¦¨¤F,
½Ð¸Õ¸Õ¬Ý:- 'קï¦Û¤U¦Cºô¶¡G
- 'http://www.ozgrid.com/forum/showthread.php?t=83326
- 'Border Around Each Printed Page
- 'VB:
- Sub testPages()
- Dim lastRow, lastCol, lastRow2, lastCol2 As Integer
- Dim HPBreak, VPBreak, totHP, totVP As Integer
- Dim cVP, rHP, row1, cow1, flagHP, flagVP As Integer
- Dim ar
-
- With ActiveSheet
-
- '¨ú±o¦C¦L½d³ò ªº ¤UÃä¬É¤Î¥kÃä¬É
- '³o¬O¤ñ¸û¸û²Âªº¤èªk, ¦p¦³¸û²±¶ªº¤èªk, ·Ð½Ð§iª¾
- strPrintArea = .PageSetup.PrintArea
- ar = Split(strPrintArea, ":")
- ar = Split(ar(1), "$")
- lastRow = --ar(2)
- lastCol = Asc(ar(1)) - 64
-
- totVP = .VPageBreaks.Count '¨ú±o ««ª½¤À¶½u ªº Á`¼Æ
- totHP = .HPageBreaks.Count '¨ú±o ¤ô¥¤À¶½u ªº Á`¼Æ
-
- '¨ú±o ³Ì¤j¤ô¥¤À¶½u ©Ò¦bªº ¤UÃä¬É
- lastRow2 = .HPageBreaks(totHP).Location.Row - 1
- '¨ú±o ³Ì¤j««ª½¤À¶½u ©Ò¦bªº ¥kÃä¬É
- lastCol2 = .VPageBreaks(totVP).Location.Column - 1
-
- '¤½¦¡¡G¦C¦LÁ`¶¼Æ = (VPageBreaks.Count + 1)*(HPageBreaks.Count+1)
- '¨Ã«D¤@Åé¾A¥Î, why? ½Ð°Ñ¦Ò¤U¹Ï§Yª¾:
- '¥H¤U×¥¿ ¦C¦LÁ`¶¼Æ ªº¤½¦¡
- If lastRow2 = lastRow Then
- flagHP = 0
- Else
- flagHP = 1
- End If
- If lastCol2 = lastCol Then
- flagVP = 0
- Else
- flagVP = 1
- End If
-
- totHP = totHP + flagHP
- totVP = totVP + flagVP
-
- 'pºâ¥þ³¡¦C¦L¶¼Æ
- totPg = (totVP) * (totHP)
-
- '¤]¥i³z¹L Excel4Macro ¨ú±o¥þ³¡¦C¦L¶¼Æ (Excel 2003¥H¤U¾A¥Î)
- 'totPg = ExecuteExcel4Macro("Get.Document(50)")
-
- cow1 = 1
- currentP = 1
-
- For VPBreak = 1 To totVP
-
- If VPBreak = totVP Then
- cVP = lastCol
- Else
- cVP = .VPageBreaks(VPBreak).Location.Column - 1
- End If
-
- For HPBreak = 1 To totHP
- '¨ú±o¥Ø«e¤ô¥¤À¶½uªº¤UÃä¬É
-
- If HPBreak = totHP Then
- rHP = lastRow
- Else
- rHP = .HPageBreaks(HPBreak).Location.Row - 1
- End If
- .Cells(rHP, Int((cVP - cow1 + 1) / 2) + cow1) = "¦@" & totPg & "¶¤§²Ä" & currentP & "¶"
- currentP = currentP + 1
- Next
- cow1 = cVP + 1
- Next
- End With
-
- End Sub
½Æ»s¥N½X |
|