rajkumar
12-27-2010, 10:59 AM
Hi,
Needing your expertise in solving my problem. I have an add in which is used to import text files from folder to create reports.
They are basically an output from oracle. Whenever the report format changes i need to re write the whole macro to accommodate the changes. that's fine but i have send the whole add in to every user in my office.
Instead i want to just replace the affected report module alone.
I tried to use the code below
Option Explicit
Sub testme()
Dim VBProj As Object 'VBIDE.VBProject
Dim myFileName As String
myFileName = "C:\Data_Analysis\Updates\test.bas"
Set VBProj = Nothing
On Error Resume Next
Set VBProj = ThisWorkbook.VBProject
On Error GoTo 0
If VBProj Is Nothing Then
MsgBox "Can't continue--I'm not trusted!"
Exit Sub
End If
VBProj.vbcomponents.Import myFileName
End Sub
This could import me the required module and i find the file is duplicated as test1.bas.
How do i maintain a list of module name in a column within one of the add-in's worksheets and the macro to read and compare them while importing and delete the old one and import the new one.
My VBA project is password protected. I want the code to enter password and delete the old module and import the new module and save the addin.
It will be great if some one can help me to do it
Thanks
Raj :help
Needing your expertise in solving my problem. I have an add in which is used to import text files from folder to create reports.
They are basically an output from oracle. Whenever the report format changes i need to re write the whole macro to accommodate the changes. that's fine but i have send the whole add in to every user in my office.
Instead i want to just replace the affected report module alone.
I tried to use the code below
Option Explicit
Sub testme()
Dim VBProj As Object 'VBIDE.VBProject
Dim myFileName As String
myFileName = "C:\Data_Analysis\Updates\test.bas"
Set VBProj = Nothing
On Error Resume Next
Set VBProj = ThisWorkbook.VBProject
On Error GoTo 0
If VBProj Is Nothing Then
MsgBox "Can't continue--I'm not trusted!"
Exit Sub
End If
VBProj.vbcomponents.Import myFileName
End Sub
This could import me the required module and i find the file is duplicated as test1.bas.
How do i maintain a list of module name in a column within one of the add-in's worksheets and the macro to read and compare them while importing and delete the old one and import the new one.
My VBA project is password protected. I want the code to enter password and delete the old module and import the new module and save the addin.
It will be great if some one can help me to do it
Thanks
Raj :help