scaiels
09-22-2008, 04:45 AM
Hi,
I have an application that creates a text file called external.bas containing this . . .
Attribute VB_Name = "External"
Sub External()
OK = MsgBox("External", vbOKCancel)
End Sub
In reality, it's a script to create a flow chart in Visio, but I have a problem even with the script above.
In visio, I have this script.
Private Sub Project2Flowchart()
Visio.Application.Vbe.ActiveVBProject.VBComponents.Import ("C:\External.bas")
Call External.External
End Sub
I know that's not the orthodox way of forming the code, but the method I?m using to create the codes needs to use the minimum number of lines.
The first time I run the script, the external .bas file is successfully imported into a module called external, but the ?call external.external? line fails with an ?Object Required? error. If I just run it again, it fails again.
However, if I debug, and break out of the script, then run it again. Or retype the ?call external.external? line, then it works fine.
It seems I have to somehow ?refresh? the script parser for it to find the newly imported module. Is there any code that will do that for me?
As you can tell from my vba vocabulary, I?m very new to this and by no means a coder.
Any help very much appreciated.
Thanks,
Steve.
I have an application that creates a text file called external.bas containing this . . .
Attribute VB_Name = "External"
Sub External()
OK = MsgBox("External", vbOKCancel)
End Sub
In reality, it's a script to create a flow chart in Visio, but I have a problem even with the script above.
In visio, I have this script.
Private Sub Project2Flowchart()
Visio.Application.Vbe.ActiveVBProject.VBComponents.Import ("C:\External.bas")
Call External.External
End Sub
I know that's not the orthodox way of forming the code, but the method I?m using to create the codes needs to use the minimum number of lines.
The first time I run the script, the external .bas file is successfully imported into a module called external, but the ?call external.external? line fails with an ?Object Required? error. If I just run it again, it fails again.
However, if I debug, and break out of the script, then run it again. Or retype the ?call external.external? line, then it works fine.
It seems I have to somehow ?refresh? the script parser for it to find the newly imported module. Is there any code that will do that for me?
As you can tell from my vba vocabulary, I?m very new to this and by no means a coder.
Any help very much appreciated.
Thanks,
Steve.