Home > Software engineering >  Vb to make software run on some computer display error
Vb to make software run on some computer display error

Time:09-17

Vb software to run on some computer can't work normally, the program is in win764 system, execl access is 2010 references is 14.0, involves some function calls execl, sometimes shows 48 load the DLL errors, sometimes shows the class does not support Automation or does not support expected interface, program is encapsulated with factory7.0, xp + 2003 experimental computer (PC) can use Windows 7 32 + office2010 (desktop) sometimes can sometimes (notebook) appears the mistake I describe, everyone to analysis the problem in where? Is the system reason or execl version? Is there a good way to improve a good way to support for execl version? Below is a part of the code
Private Sub daochu_Click ()
Dim the I, J, c As Long
Dim conn As ADODB. Connection
Dim RST As ADODB. You
Call xinjian
Set the conn=New ADODB. Connection
The Set RST=New ADODB. You
Conn. The ConnectionString="Provider=Microsoft. Jet. The oledb. 4.0; Data source="& amp; App. The Path & amp; "\ 2018. MDB;"
Conn. Open
RST. CursorLocation=adUseClient
RST. Open the "select * from table" new, conn, adOpenDynamic adLockOptimistic,
Dim Dim MyApp As Object 'MyApp As Excel. The Application
Dim MyBook As Object 'Dim MyBook As Excel. The Workbook
Dim MySheet As Object 'Dim MySheet As Excel. The Worksheet
The Set MyApp=CreateObject (" Excel. Application ")
MyApp. Visible=False
The Set MyBook=MyApp. Workbooks. The Add ()
The Set MySheet=MyBook. Worksheets (1)
For c=0 To RST. Fields. The Count - 1
MySheet. Cells (c + 1, 1)=RST. Fields (c). The Name
Next
J=2
EOF
Do Until RST.For I=1 To RST. Fields. The Count
MySheet. Cells (J, I)=RST. Fields (I - 1)
Next
RST. MoveNext
J=J + 1
Loop
Xinjian
MyBook. SaveAs "d: \ \ group registration results 2018 BMJG. XLS"
MyApp. Quit
The Set MyApp=Nothing
RST. Close
The Set of RST=Nothing
Set the conn=Nothing
FileCopy App. Path & amp; "\ 2018. MDB", "d: \ \ group registration results 2018. MDB"
MsgBox "export success! File in d: \ group registration knot \ 2018 BMJG XLS ", vbOKOnly, "tip"
End Sub

CodePudding user response:

Suspected problem office version

CodePudding user response:

I can not I

CodePudding user response:

refer to the second floor weixin_43137121 response:
I won't I won't

Register on the first day, let you go to the little black house reflection,

CodePudding user response:

Path or database driver problem, you add a
On error goto errp:
. Your code is
The exit sub
Errp:
Msgbox err. The description 'output error information

CodePudding user response:

Don't quote, all objects used by CreatObject create,
And a method of partial door, that is, to read the registry, get the current versions of Excel, according to the registry to find the position of the DLL, and then directly through the DLL file creation "COM components using" (this method can dynamically create COM components, and need not registered components can also be used), according to different into each version version of the special process using objects, specific can go to understand the IUnknown LoadCOMObject, very simple

CodePudding user response:

Before met, office, need this package or library version is consistent, packaging when you need to choose multiple component library

CodePudding user response:

Office version might be the problem

CodePudding user response:

I think the vb very good very strong

CodePudding user response:

Conn. The ConnectionString="Provider=Microsoft. Jet. The oledb. 4.0; Data source="& amp; App. The Path & amp; "\ 2018. MDB;"

A lack of control will have a problem, please install the OFFICE 2000 above, should be ok,
  • Related