Home > Software engineering >  Using VB to call specifies the EXCEL file contains macros, after opening, run the macro file, abnorm
Using VB to call specifies the EXCEL file contains macros, after opening, run the macro file, abnorm

Time:10-04

Be urgent!!!! Be urgent!!!! And seek to reassure risk
Problem: the program written in VB call specifies the EXCEL file contains macros, after open the EXCEL file, run in the EXCEL file forms the hidden form command will close the EXCEL file, may not be the solution???
My computer is XP fashion is an original, change program is useful, now computer upgraded to Windows 7 32 bit x pro system and install office2010, change application for the above problems, ask ace to give directions
VB code is as follows:
On the Local Error GoTo errhandle
If ISruningxls=False Then
The Set objexl=New Excel. Application
Objexl. Visible=True
Objexl. Workbooks. Open the App. The path & amp; "Check \ XX. XLS"
Objexl. Windows (" check XX. XLS "). The Activate
The Set wb=objexl. ActiveWorkbook
End the If
ISruningxls=FileExists (" c: \ checkdmexcel. Bz ")
The Do While ISruningxls
ISruningxls=FileExists (" c: \ checkdmexcel. Bz ")
If Not ISWORKBOOKOPEN (" SJZLDM. TXT ", objexl) Then
Kill "C: \ checkdmexcel bz"
The Exit Do
End the If
DoEvents
Loop
Objexl. ActiveWorkbook. Close False
Errhandle:
Objexl. Quit

=="" "" "" "" "" "" "" "" "
EXCEL in the execution of the me. Hide the event when close the EXCEL

CodePudding user response:

Supplement: vb without compiled to an executable file, you can run normally, compiled to EXE again after operation, EXCEL will shut down,

CodePudding user response:

If objexl is a process variable, the result cans be imagined, if not, the errhandle: behind don't quit, but the content of the output error and see...

CodePudding user response:

Objexl is a global variable, this program is useful in XP system;
Hidden behind the errhandle: don't quit, VBA form or close EXCEL
I feel I can make the Windows 7 in my computer has a problem
  •  Tags:  
  • VBA
  • Related