Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - There is a form code in the program written by VB that I can't understand. Please help me.
There is a form code in the program written by VB that I can't understand. Please help me.
Private subcommand 1 _ click (index is an integer) click operation, and input plastic index parameters.

Different Select Case Index index correspond to different processing methods.

Case 0 If the index is 0, execute fndtomsh, and there is no description of this function in the provided code.

FNDtoMSH

Case 1 If the index is 1, the dc method is executed.

direct current

Case 4 If the index is 4, it should be an operation such as releasing the form or closing the form.

Unload me.

End selection

End joint

Sub-DC DC method

The following is a typical method of operating execel using Microsoft office interface, and there are many examples on the Internet.

Dim ExcelApp as an object

Dim ExcelWorkBook as an object

Dim ExcelWorkSheet as an object

Go to ErrH when an error occurs.

set excel app = createobject(" excel。 Application ")' Create Excel.

Set excel workbook = excel. Workbooks.add create an excel document book.

Set excel worksheet = excel workbook. Worksheet (1)' Create a worksheet in the document.

Excelapp。 Visible = true' excel operation is visible.

Because i = 0 to MSH. The msh is not mentioned in the Rows- 1 method. It should be a parameter in the following form.

Is a double loop, set for each row and column.

For j = 0 to MSH. Cols - 1

Assign the specified column of the specified row to I and J corresponding to MSH. Text matrix

ExcelWorkSheet.cells(i + 1,j + 1) = MSH。 Text matrix (i, j)

then

then

outlet connection

ErrH: If there is an error and you jump here, here is the excel resource to release the call.

ExcelApp。 give up

Set ExcelApp = Nothing.

Set ExcelWorkBook = Nothing.

Set ExcelWorkSheet = Nothing.

MsgBox error. describe