|
用vb把vba代码封装dll时,这个vba代码怎么改写?请高手帮忙!!!!
Public Sub auto_open()
On Error Resume Next
Application.CommandBars(1).Reset
Application.CommandBars(1).Controls("Qopani").Delete
Dim myControlButton As Object
Dim sani%
sani = Application.CommandBars(1).Controls.Count
Set myControlButton = Application.CommandBars(1).Controls.Add( _
Type:=msoControlButton, Before:=sani + 1)
With myControlButton
.Caption = "Qopani"
.OnAction = "Qopani1"
.Style = msoButtonCaption
End With
End sub
Public Sub fffff()
Dim i%, Ps%
Ps = ExecuteExcel4Macro("GET.DOCUMENT(50)")
Select Case Ps
Case Is > 0
If MsgBox(vbCrLf & "nnnn" ,vbQuestion + vbOKCancel, " ttt") = vbOK Then
ActiveSheet.PrintOut From:=1, To:=1, Copies:=1, Collate:=True
Else
For i = 1 To Ps Step 1
ActiveSheet.PrintOut From:=i, To:=i
Next i
End If
Case Is = 0
MsgBox vbCrLf & vbCrLf & " rrrr " , vbQuestion + vbOKOnly, " ttt"
End Select
End Sub
Public Function Page(x As Range, z As Byte)
Dim ih%
Dim yh As Variant
If z = 0 Then
ih = 0
For Each yh In ActiveSheet.HPageBreaks
ih = ih + 1
If x.Row <= yh.Location.Row Then
Page = ih
Exit Function
End If
Next yh
Page = ih + 1
Else
Page = (ActiveSheet.HPageBreaks.Count + 1) * (ActiveSheet.VPageBreaks.Count + 1)
End If
Application.Volatile
End Function
Public Sub yyyy()
Dim x As Variant
Dim c As Variant
Dim m As Variant
Dim p As Variant
x = ActiveCell.Address
Application.ScreenUpdating = False
c = ActiveSheet.VPageBreaks.Count
If c >= 1 Then m = ActiveSheet.VPageBreaks(1).Location.Column
ActiveWindow.View = 2
p = Page(ActiveCell, 0)
If ActiveCell.Column >= m Then p = p + ActiveSheet.HPageBreaks.Count + 1
ActiveWindow.View = 1
msgbox p
end sub
|
|