View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
jaf jaf is offline
external usenet poster
 
Posts: 300
Default activate PublicConst

Hi Michel,
"Drive" is a VBA keyword and trying to redefine it into a constant may be
causing the problem.
Try MyDrive.



--

John

johnf202 at hotmail dot com


"MD" wrote in message
.. .
I have a workbook AA.xls that contains an Auto_Open sub
Dim VBComp As VBComponent
Set VBComp = ThisWorkbook.VBProject.VBComponents("Public")
ThisWorkbook.VBProject.VBComponents.Remove VBComp
Dim FName As String
FName = "c:\mam97\code.txt"
ThisWorkbook.VBProject.VBComponents.Import FName
End Sub

The content of the txt file is:

Attribute VB_Name = "Publique"
Public Const Drive = "c:"

When the auto_open execute it does not activate my Public Const "DRIVE"

and
assign it the value of C: !!

Any clues????

Regards Michel