Home > Software engineering > Could you tell me how to solve the following problems using VB program to read and write Excel?
Could you tell me how to solve the following problems using VB program to read and write Excel?
Time:10-06
1. The Excel file on the specified in the program of change seems to exit the program after failure, 2. Each time will open the Excel file to Excel operation, The above two are don't want to appear as a result, how can I solve! Part of the program code, what should be amended? Private Sub Datadeal () Call the test () Dim N As Integer Dim xlapp As Excel. Application Dim xlwork As Excel. The Workbook Dim xlsheet As Excel. The Worksheet Xlapp=CreateObject (" Excel. Application ") Xlapp. Visible=True Xlwork=xlapp. Workbooks. Open (" F: \ VB \ "Blood XLSX") Xlsheet=xlwork. Worksheets (1) Xlsheet. Activate () For N=1 To 50 Xlsheet. Cells (1, N)=TD (N) The Next N Xlsheet. Cells (1, 1)="ABC" Xlapp=Nothing Xlwork=Nothing Xlsheet=Nothing End Sub
CodePudding user response:
1 lack save before release statement Xlapp. Saved=True 2 screen display statement Xlapp. Visible=True
CodePudding user response:
This read only the problem of how to fix! Seems I open will appear after the file has been is in a state of be edited, become read-only