123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 |
- VERSION 5.00
- Begin {C62A69F0-16DC-11CE-9E98-00AA00574A4F} UniteOne
- Caption = "CorelDRAW 合并多页为一页 蘭雅sRGB 2010-2022"
- ClientHeight = 4005
- ClientLeft = 45
- ClientTop = 330
- ClientWidth = 5220
- OleObjectBlob = "UniteOne.frx":0000
- StartUpPosition = 1
- End
- Attribute VB_Name = "UniteOne"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Option Explicit
- #If VBA7 Then
- Private Declare PtrSafe Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
- Private Declare PtrSafe Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
- #Else
- Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
- Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
- #End If
- Dim iHang, iLie, iPages As Integer
- Dim iYouyi, iXiayi As Single
-
- Dim LogoFile As String
-
- Dim s(1 To 255) As Shape
- Dim p As Page
-
- Private Sub cmdRun_Click()
-
- Application.Optimization = True
- ActiveDocument.BeginCommandGroup
- Dim x_M, y_M
- ActiveDocument.Unit = cdrMillimeter
- ActiveDocument.EditAcrossLayers = False
-
- For Each p In ActiveDocument.Pages
- p.Activate
- p.Shapes.All.CreateSelection
- Set s(p.index) = ActiveSelection.Group
- Next p
-
- ActiveDocument.EditAcrossLayers = True
-
- x_M = y_M = 0
-
- For Each p In ActiveDocument.Pages
- p.Activate
-
- s(p.index).MoveToLayer ActivePage.DesktopLayer
- s(p.index).Move (iYouyi * x_M), -(300 + iXiayi * y_M)
-
- y_M = y_M + 1
-
- If y_M = iLie Then
- x_M = x_M + 1
- y_M = 0
- End If
-
- Next p
-
- ActiveDocument.EndCommandGroup
- Application.Optimization = False
- ActiveWindow.Refresh
- Application.Refresh
- Unload Me
- End Sub
- Private Sub cmdRunX_Click()
-
- Application.Optimization = True
- ActiveDocument.BeginCommandGroup
- Dim x_M, y_M
- ActiveDocument.Unit = cdrMillimeter
- ActiveDocument.EditAcrossLayers = False
-
- For Each p In ActiveDocument.Pages
- p.Activate
- p.Shapes.All.CreateSelection
- Set s(p.index) = ActiveSelection.Group
- Next p
-
- ActiveDocument.EditAcrossLayers = True
-
- x_M = y_M = 0
-
- For Each p In ActiveDocument.Pages
- p.Activate
-
- s(p.index).MoveToLayer ActivePage.DesktopLayer
- s(p.index).Move (iYouyi * y_M), -(600 + iXiayi * x_M)
-
- y_M = y_M + 1
-
- If y_M = iHang Then
- x_M = x_M + 1
- y_M = 0
- End If
-
- Next p
-
- ActiveDocument.EndCommandGroup
- Application.Optimization = False
- ActiveWindow.Refresh
- Application.Refresh
-
- Unload Me
- End Sub
- Private Sub UserForm_Initialize()
- Dim s As Shape
- ActiveDocument.Unit = cdrMillimeter
- For Each p In ActiveDocument.Pages
- iPages = p.index
- If iPages = 1 Then
- p.Activate
- p.Shapes.All.CreateSelection
- Set s = ActiveDocument.Selection
- If s.Shapes.Count = 0 Then
- MsgBox "当前文件第一页空白没有物件!"
- Exit Sub
- End If
-
- End If
- Next p
-
- txtLie.text = 5
- txtHang.text = Int(iPages / CInt(txtLie.text) + 0.9)
- txtLie.text = Int(iPages / CInt(txtHang.text) + 0.9)
-
- iHang = CInt(txtHang.text)
- iLie = CInt(txtLie.text)
-
-
- iYouyi = Int(s.SizeWidth + 0.6)
- iXiayi = Int(s.SizeHeight + 0.6)
-
- txtYouyi.text = iYouyi
- txtXiayi.text = iXiayi
-
- LogoFile = Path & "GMS\262235.xyz\LOGO.jpg"
- If API.ExistsFile_UseFso(LogoFile) Then
- LogoPic.Picture = LoadPicture(LogoFile)
- End If
-
- txtInfo.text = "本文档共 " & iPages & " 页,首页物件尺寸(mm):" & s.SizeWidth & "×" & s.SizeHeight
-
- End Sub
- Private Sub cmdHelp_Click()
- WebHelp
- txtInfo.text = "点击访问 https://262235.xyz 详细帮助,寻找更多的视频教程!"
- txtInfo.ForeColor = &HFF0000
- cmdHelp.Caption = "在线帮助"
- cmdHelp.ForeColor = &HFF0000
- End Sub
- Private Sub cmdClose_Click()
- Unload Me
- End Sub
- Private Sub txtHang_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
- Dim Numbers As String
- Numbers = "1234567890"
- If InStr(Numbers, Chr(KeyAscii)) = 0 Then
- KeyAscii = 0
- End If
- End Sub
- Private Sub txtLie_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
- Dim Numbers As String
- Numbers = "1234567890"
- If InStr(Numbers, Chr(KeyAscii)) = 0 Then
- KeyAscii = 0
- End If
- End Sub
- Private Sub txtXiayi_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
- Dim Numbers As String
- Numbers = "1234567890" + Chr(8) + Chr(46)
- If InStr(Numbers, Chr(KeyAscii)) = 0 Then
- KeyAscii = 0
- End If
- End Sub
- Private Sub txtYouyi_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
- Dim Numbers As String
- Numbers = "1234567890" + Chr(8) + Chr(46)
- If InStr(Numbers, Chr(KeyAscii)) = 0 Then
- KeyAscii = 0
- End If
- End Sub
- Private Sub txtHang_Change()
- Dim n As Single
- n = Val(txtHang.text)
- If n > 0 And n < 1001 Then
- HangSpin.value = n
- iHang = n
- End If
-
- txtHang.text = iHang
- txtLie.text = Int(iPages / iHang + 0.9)
-
-
- iLie = CInt(txtLie.text)
-
- End Sub
- Private Sub HangSpin_Change()
- txtHang.text = CStr(HangSpin.value)
- End Sub
- Private Sub txtLie_Change()
- Dim n As Single
- n = Val(txtLie.text)
- If n > 0 And n < 1001 Then
- LieSpin.value = n
- iLie = n
- End If
-
- txtLie.text = iLie
- txtHang.text = Int(iPages / iLie + 0.9)
-
- iHang = CInt(txtHang.text)
- End Sub
- Private Sub LieSpin_Change()
- txtLie.text = CStr(LieSpin.value)
- End Sub
- Private Sub txtXiayi_Change()
- Dim n As Single
- n = Val(txtXiayi.text)
- If n > 0 And n < 1001 Then
- iXiayi = n
- End If
- End Sub
- Private Sub txtYouyi_Change()
- Dim n As Single
- n = Val(txtYouyi.text)
- If n > 0 And n < 1001 Then
- iYouyi = n
- End If
- End Sub
- Function WebHelp()
- Dim h As Long, r As Long
-
- If cmdHelp.Caption = "在线帮助" Then
- h = FindWindow(vbNullString, "CorelDRAW 合并多页为一页 蘭雅sRGB 2010-2022")
- r = ShellExecute(h, "", "https://262235.xyz/index.php/tag/vba/", "", "", 1)
- End If
- End Function
|