Home > Software engineering >  Excel VBA reference version problem, a solution
Excel VBA reference version problem, a solution

Time:11-13

Using the following in AutoCAD VBA code:
Dim Excel As Object
The Set of Excel=CreateObject (" Excel. Application ")
Reference version is office 2013 edition, Excel 15.0


After the replacement of computer and replacement for Excel 2007 version, tools - & gt; In the reference tip "lost: the Microsoft Excel 15.0... ", program error, need to get rid of "lost: Microsoft Excel 15.0... "In front of the hook, and then on" Microsoft Excel 12.0... ", the program can run normally,


Is there any way to avoid this problem, that is, to create the Excel object, not prompt reference library is missing, across versions of the reference to Excel,
Consult everybody,

CodePudding user response:

This is a simple, "reference", when the design code, the reference line,
Who use the WorkBook, "type" variables WorkSheet, all to the Object types,

CodePudding user response:

Still error, according to cad in 2014 "(Automation) Automation error"

CodePudding user response:

No reference to the Set of Excel=CreateObject (" Excel. Application ") error of the sentence?
Impossible!!!!
VB6, VBS, such as can normal execution,

CodePudding user response:

reference 1st floor Chen8013 response:
this simple, "reference" in design, coding, the reference line,
Who use the WorkBook, "type" variables WorkSheet, all to the Object types,

I also met the problem now, Windows 7 platform excel: sure, but on the notebook WIN10 excel2016 open will be an error, can't find the project or library, read the baidu, cancel the missing in the reference check, and then submitted to the variable is undefined
 Private Sub Workbook_Open () 

Call Prime_A_PRJ. Menu_Caption
Call Prime_A_PRJ. Sheet_Lock

ActiveWorkbook. Worksheets (" Menu "). Select
End Sub

CodePudding user response:

In a 64 - bit Windows:
64 exe and DLL in the directory c: \ Windows \ sys tem32 directory.
32 bit exe and DLL in the directory c: \ Windows \ sys wow64 directory.
So pay attention to:
In win64 system registered under 32-bit ocx DLL to 32 ocx or copy the DLL to the c: \ Windows \ syswow64 \ directory,
And registered to c: \ Windows \ syswow64 \ regsvr32 XXXXXXX ocx or DLL
A 64 - bit Windows platform attention point of the file system redirection http://www.cnblogs.com/jiake/p/4981555.html
64 - bit Windows platforms attention point of the registry to redirect http://www.cnblogs.com/jiake/p/4956218.html

CodePudding user response:

Excel2016 points 32-bit/64 - bit, I guess,

CodePudding user response:

Chen602832991
reference 4 floor response:
Quote: refer to 1st floor Chen8013 response:

This is a simple, "reference", when the design code, the reference line,
Who use the WorkBook, "type" variables WorkSheet, all to the Object types,

I also met the problem now, Windows 7 platform excel: sure, but on the notebook WIN10 excel2016 open will be an error, can't find the project or library, read the baidu, cancel the missing in the reference check, and then submitted to the variable is undefined
 Private Sub Workbook_Open () 

Call Prime_A_PRJ. Menu_Caption
Call Prime_A_PRJ. Sheet_Lock

ActiveWorkbook. Worksheets (" Menu "). Select
End Sub


"ActiveWorkbook" didn't see you!
This can only be used in Excel VBE varies, all the other conditions don't have the "default object"!!!!!!!!!
You don't use this code in VB6, prompt "variable is undefined" is odd,

Even cited the Excel object library, also can not directly use the object "ActiveWorkbook",
What's more, the way I said, it is required in the "engineering" no reference object library,

CodePudding user response:

refer to 6th floor zhao4zhong1 response:
Excel2016 points 32-bit/64 - bit, I guess,

Also guess a bird...


From Office 2007 points and 64 - bit and 32-bit, let alone 2016,

I recently wrote a piece of software, is to use CreateObject (" Excel. Application ") to create Excel object,
On my computer:
WinXP + Office 2003
Windows 7 SP1/64 + Office 2007 32-bit
Win 10 professional version of 64 + Office 2010, 64,
Run completely normal,

CodePudding user response:

I put the VBA when VB6!

CodePudding user response:

references 9 f zhao4zhong1 response:
I put the original VBA when VB6!

Whether VBA (not Excel environment VBE varies), or VB6, if you want to use "Ecxel object", method is almost the same,

CodePudding user response:

VB6 (32-bit) can call 64 Excel object?
Science,

CodePudding user response:

The
reference 11 floor zhao4zhong1 reply:
VB6 (32-bit) can call 64 Excel object?
Science,

Excel "background COM process" is ActiveX EXE process!
After the success of the program "create Excel object", it is a separate process,
Can't it respectively both 32-bit and 64 - bit COM Object interface!!!!!!
As long as the COM object implements the communication with ActiveX EXE, specific operation performed by the EXE to finished it,
Such, a 32-bit program, very convenient also "operating" 64 program...

You are a veteran, such a simple truth, but I remind you?

CodePudding user response:

refer to 12 floor Chen8013 reply:
Quote: reference 11 floor zhao4zhong1 response:

VB6 (32-bit) can call 64 Excel object?
Science,

Excel "background COM process" is ActiveX EXE process!
After the success of the program "create Excel object", it is a separate process,
Can't it respectively both 32-bit and 64 - bit COM Object interface!!!!!!
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • VBA
  • Related