activate PublicConst

M

MD

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
 
J

jaf

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top