Home > Software engineering >  Programs written in VB6 can not run under Windows 7, the individual win10 running also wrong, please
Programs written in VB6 can not run under Windows 7, the individual win10 running also wrong, please

Time:09-17

Everybody, good webmaster,
In win10 64 home edition to use VB6 program can not run on Windows 7, on a colleague win10 can run, specific as follows:
I system platform are as follows: win10 family version, office 2013
1) my programs are written in VB6 platform, call call to excel in the user input data on the form, and save to excel XLS format file and TAB delimited. TXT file,
2) in the setup factory 9.1 installation package, installed and run under most win10, but in a colleague's win10 home edition and excel 2010 installed On normal, but the runtime can't Open I specify excel file template, return an Error number is: 2147021892, the program code is as follows: On the Error Resume Next Set ExlWorkBook=Exlapp. Workbooks. Open (App) Path & amp; "\ Spec_Upld_Template. XLS")
3) is installed in Windows 7 is normal, the runtime "unexpected error",
Kneel beg god give directions, thank you, thank you, thank you!

CodePudding user response:

On the Error Resume Next


Applications need to use the process of "third party" such as Excel to operate, also dare to On Error Resume Next
In this, also want to find "the reason for the error!" Wash your sleep...

CodePudding user response:

How to improve? Elder give advice or comments, please!!!!!

CodePudding user response:

Because you compiled environment based on 2013, so the compiled 2010 wrong calls,
Do you want to compile environment based on 2010, and then call 2013 is steady

CodePudding user response:

Chewinggum
reference 4 floor response:
environment based on 2013 compiled because of you, so the compiled 2010 wrong calls,
Do you want to compile environment based on 2010, and then call 2013 was steady

I don't think so,


Before I thought with "static library procedures, different versions of" excel object may have a problem, "
But recently I tried (static reference TLB, whether or not the test process of Excel object creation) properly:
WinXP + 2003 programs compiled in Win 7 + 2007 running normally;
Win 7 + 2007 programs compiled to WinXP + 2003 is also normal,
Since Excel object process successfully created, other basic operation will be a problem,
In my program, main is to read and write Excel document data, basic without what charts, Shaps objects, such as
Still feel that, however, even if want to make these operations, the problem should also not quite, key or process object can be created, start here,

Other I don't want to say more, anyway, the original poster is ignored,

CodePudding user response:

Try not to directly call Excel components, but with the Jet Engine will Excel file as an external database to handle,

CodePudding user response:

On the Error Resume Next
After an error, should already be the program's second mistake
Looks like the wrong version problem,
Recommend not static reference, try to switch to CreateObject dynamic object creation

CodePudding user response:

I am use CreateObject, as follows:

Private Sub Form_Load () 'this application start loading content
'On the Error Resume Next
The Set Exlapp=CreateObject (" Excel. Application ")
'new Excel Application process'Set Exlapp=New excel. Application
Welcome. Inisms. Caption="is testing whether Micosoft Excel Application installation... "
If Err Then
MsgBox "detected the machine has not been installed or not properly installed Micosoft Excel Application! Program can not discontinuous running!" & CRH (13) & amp; "Error code:" & amp; Err
Err. Clear
Unload the welcome
End
End the If
Welcome. Inisms. Caption="being loaded Florens Datasheet template... "
Exlapp. DisplayAlerts=False 'close Excel all warning
'On the Error Resume Next
The Set ExlWorkBook=Exlapp. Workbooks. Open (App) Path & amp; "\ Spec_Upld_Template. XLS") 'open under this application path Florens Upload File template
If Err Then
MsgBox "Spec_Upld_Template was not found in the path of the program. The XLS template, system cannot be initialized! Will terminate running!" & CRH (13) & amp; "Error code:" & amp; Err
Err. Clear
If the welcome. Visible Then Unload the welcome
ExlWorkBook. Close
Exlapp. DisplayAlerts=True
Exlapp. Quit
The Set ExlWorkBook=Nothing
The Set Exlapp=Nothing
End
End the If
StatusBar1. Panels (1). The Text="Excel application instance is created, Spec_upld_Template. XLS templates are loaded properly!"
SSTab1. TabEnabled (1)=False
SSTab1. TabEnabled (0)=True
SSTab1. Tab=1
SSTab1. TabVisible (1)=True
VScroll1. Max=Cerworkspace. Height - ACspace. Height + 375
VScroll1. Min=1
VScroll1. SmallChange=380
VScroll1. LargeChange=1900
SSTab1. Tab=0
'Sleep 1000
Unload the welcome
End Sub

CodePudding user response:

reference 5 floor Chen8013 reply:
Quote: refer to 4th floor chewinggum response:

Because you compiled environment based on 2013, so the compiled 2010 wrong calls,
Do you want to compile environment based on 2010, and then call 2013 was steady

I don't think so,


Before I thought with "static library procedures, different versions of" excel object may have a problem, "
But recently I tried (static reference TLB, whether or not the test process of Excel object creation) properly:
WinXP + 2003 programs compiled in Win 7 + 2007 running normally;
Win 7 + 2007 programs compiled to WinXP + 2003 is also normal,
Since Excel object process successfully created, other basic operation will be a problem,
In my program, main is to read and write Excel document data, basic without what charts, Shaps objects, such as
Still feel that, however, even if want to make these operations, the problem should also not quite, key or process object can be created, start here,

Other I don't want to say more, anyway, the original poster is ignored,


Not necessarily, the key to see whether function or method call compatible,
Such as an activex DLL version 1.0, there is a prototype for the test (as a string) as a function of long, in version 2.0, this function to test (as a string, optional b as string) as long and project to do the binary compatible with the

Then cited the 1.0 version of the code compiled exe in the registered version 2.0 of the computer, everything is normal,
Reference version 2.0 was compiled, the registration in the 1.0 version of the machine, create the object won't be wrong, but once the call this test will be a problem, even if only one parameter,
This compatibility had puzzled for a long time, our company will compile a carelessly problems and then write a program to check all the com components compatibility,

CodePudding user response:

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related