Vb to download from the web XLSX file, Set xlbook=xlapp. Workbooks. Open (s) to Open The Times wrong, manually Open XLSX found file is in need of repair,
Again after repair save execution can smoothly open with the code, please everyone a great god, and how to use vb code to avoid this problem, how can I open this needs to be fixed XLSX file directly,
Have to try the following method is invalid,
Application. DisplayAlerts=True/false
The following is a code
Private Sub Command16_Click ()
Call jianCha_s (" D: \ Users \ dell \ accessories \ \ Desktop \ on-demand audit 2-180625-005-00962. The XLSX ")
End Sub
Private Function jianCha_s As String (s)
Dim I As an Integer, As Integer x, y As an Integer, j As an Integer, As an Integer k, z As an Integer, zz As Integer
Dim ireco As an Integer, STRSQL As String
Dim sy () As String
If Reco. State & lt;> AdStateClosed Then
Reco. Close
The Set Reco=Nothing
End the If
STRSQL="select * from illegal_s"
Reco. Open (STRSQL), Conn, 3, 3
Ireco=Reco. RecordCount
Reco. MoveFirst
ReDim sy (ireco - 1)
For x=0 To ireco - 1
Sy (x)=Reco. Fields (1)
Reco. MoveNext
Next
Reco. Close
The Set Reco=Nothing
Application. DisplayAlerts=True
The Set xlapp=CreateObject (" excel. Application ")
Xlapp. Visible=True
The Set xlbook=xlapp. Workbooks. Open (s)
I=xlapp. Worksheets. Count
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
* * * * * * *
Xlbook. Close
Xlapp. Quit
The Set xlbook=Nothing
The Set xlapp=Nothing
Application. DisplayAlerts=True
End Function
CodePudding user response:
You try the "record", again from its code can find out what clue no,Workbooks. The Open () function has a lot of parameters, may be related to a particular parameter values (just a guess, this completely sure ).
CodePudding user response:
problem in the process of open XLSX record macroCodePudding user response:
Open the process can also be "recorded" down,Open the Excel, (the "default blank document") open the "record", and then through the tool button to open the document,
Appeared above the tip in 1 picture, point "yes", then stop the recording,
Recorded this time you can see just open the file process code,
Is there a "valuable" information, of course, it's not clear,
CodePudding user response:
Sub macro (2)'
"Acer 2
'
'
Workbooks. Open Filename:=_
"D: \ Users \ dell \ accessories \ \ Desktop \ on-demand audit 2-180625-005-00962. The XLSX"
End Sub
The bad news, there is no valuable information
CodePudding user response: