Home > Software engineering >  The run time error 429! VB in some Windows 7 running on these mistakes
The run time error 429! VB in some Windows 7 running on these mistakes

Time:11-09

VB source code:
Dim xlsApp As Object
Dim Cnn As New ADODB. Connection
Dim the Rs As the ADODB library you

Cnn. The ConnectionString="Provider=Microsoft. Jet. The OLEDB. 4.0; Data Source="& amp; Mdbpath & amp; "\ Main MDB" & amp; _
"; Mode=12; Jet OLEDB: Database Password=$p $~ djj888 xwSD - YY "
If Cnn. State & lt;> ADODB. ObjectStateEnum. AdStateClosed Then Cnn. Close
Cnn. Open

Set the Rs=New ADODB. You
With the Rs
Set the ActiveConnection=Cnn
. CursorLocation=adUseClient
The CursorType=adOpenStatic
. LockType=adLockReadOnly
. Open the "SELECT * FROM od
"End With
If the Rs. EOF Then Exit Sub
The Set xlsApp=CreateObject (" Excel. Application ")
'xlsApp. Visible=True
'(' "& amp; DH & amp; "', '" & amp; Text1. Text & amp; "', '" & amp; The Date & amp; "', '" & amp; SJ & amp; "', '" & amp; DM & amp; "')
"XlsApp. Workbooks. Add
XlsApp. Sheets (" sheet1 "). Select
XlsApp. ActiveSheet. Range (" A1 ")="number"
XlsApp. ActiveSheet. Range (" B1 ")="amount"
XlsApp. ActiveSheet. Range (" C1 ")="date"
XlsApp. ActiveSheet. Range (" D1 ")="time", "
XlsApp. ActiveSheet. Range (" E1 ")="name"
XlsApp. ActiveSheet. Range (" A2 ").
CopyFromRecordset Rs'xlBook. SaveAs (" D: \ vbexcel \ "& amp; STR)
XlsApp. ActiveSheet. Range (" d: d "). NumberFormatLocal="yyyy/mm/dd hh: mm: ss"

'
If xlsApp. ActiveWorkbook. Saved=False Then
XlsApp. ActiveWorkbook. SaveAs Environ (" USERPROFILE ") & amp; "\ Desktop" & amp; "" & amp; "Receipts statistics" & amp; Year (Now ()) & amp; The Month (Now ()) & amp; Day (Now ()) & amp; Hour (Now) & amp; Minute (Now) & amp; The Second (Now) & amp; ". XLS "
End the If
XlsApp. Quit

Rs. Close
Set the Rs=Nothing
The Set xlsApp=Nothing

Manually register regsvr32 "C: \ Program Files \ Common Files \ Microsoft Shared \ DAO \ dao360 DLL" such as DLL to use
Ask god to help solve,, the younger brother novice,

CodePudding user response:

Can try to download and install MDAC2.8:
https://www.microsoft.com/zh-CN/download/details.aspx? Id=5793

CodePudding user response:

Administrator privileges regsvr32 operation

CodePudding user response:

Debugged, after reading the wrong wrong positioning which lines of code?

CodePudding user response:

The Set xlsApp=CreateObject (" Excel. Application ") error is this line? Are you native to determine installed Excel?

CodePudding user response:

The following 429 error I normally handle
1 administrator mode, the command line run the following two sentences, register all controls
In the for % 1 (% windir % \ system32 \ *. Ocx) do regsvr32/s % 1
In the for % 1 (% windir % \ system32 \ *. DLL) do regsvr32/s % 1
2 make sure you write or reference of third-party, ocx DLL controls such as effective registration is successful, I usually take them according to the operating system version is copied to the corresponding % systemroot % \ system32 or registered under % systemroot % \ syswow64
3 such as call the office components, then make sure the machine to install the corresponding office components, such as installed, can consider to install, or try installing low version

In short track, first see an error, is that targeted for refuse scheme

CodePudding user response:

The implications of the 429 error: cannot establish object or ActiveX components return references to this object
  • Related