16,554
社区成员
发帖
与我相关
我的任务
分享
Function maxb(rng1 As Range, rng2 As Range, rng3 As Range)
maxb = 5
End Function
Option Explicit On
Imports System.IO
Imports Microsoft.Office.Interop
Public Class Form1
Dim ExAPP As New Excel.Application
Dim op As New OpenFileDialog
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
ExAPP.Visible = True
Dim Arr() = {1, 2, 3}
MsgBox(ExAPP.WorksheetFunction.Max(1, 2, 3))
Dim path As String = ""
If op.ShowDialog = Windows.Forms.DialogResult.OK Then
path = System.IO.Path.GetFullPath(op.FileName)
End If
Dim xlbook As Excel.Workbook = ExAPP.Workbooks.Open(path)
MsgBox(exapp.WorksheetFunction.maxb(1, 2, 3))
xlbook.Close()
ExAPP.Quit()
ExAPP = Nothing
End Sub
End Class