This may seem extremely easy to some as I am new to getting back into the world of VBA/macors, and similar questions have been asked by others, but I am unable to get a simple keyin load to run, and unsure why.
I have created a very simple vba project titled LoadCharacters.mvba. It has one Form named CharForm which includes a listbox to choose cells.
The project also has 1 module named LoadChar which has a simple code to run the dialog box, as shown below.
Sub StartChar() CharForm.ShowEnd Sub
If I run the vba from either the macros: Project manager or macros:macros and/or thru the VBA project editor, all runs great-exactly the way I wanted it.
Here comes the question:
I have read everywhere I think possible to locate the correct keyin to be able to run this vba thru a D&C manager item and also a custom tool. The keyin I thought should work (and I have tried many many other various iterations) is: vba run [LoadCharacters]LoadChar.StartChar
'VBA interfae error: unable to run macro - project, module, or macro not found.
Could someone please tell what I am doing wrong and help decipher this error? I have been beating my head against the wall all day.
Thank you to anyone/everyone who has suggestions.
Unknown said:vba run [LoadCharacters]LoadChar.StartChar
On the evidence you have provided, that looks like a valid key-in.
Unknown said:VBA interface error: unable to run macro - project, module, or macro not found
The file is in the wrong place...
Regards, Jon Summers LA Solutions
MS_VBASEARCHDIRECTORIES is equal to the location of the LoadCharacters.mvba. I even changed the 'equal to' from 'less than' and 'greater than' thinking that may have something to do with it..
When I go to macros:macros the LoadChar.StartChar is already populated in the window as well.
Value of configuration? Pardon my stupidity on that, what is meant by 'value'?
Unknown said:MS_VBASEARCHDIRECTORIES is equal to the location of the LoadCharacters.mvba
And what is that location? Please show the statement from your configuration file.
Unknown said: I even changed the 'equal to' from 'less than' and 'greater than' thinking that may have something to do with it
The < and > operators extend the value of an existing variable. For example...
MS_RFDIR < V:/CAD/Projects/Project1/References/
Inserts the folder before whatever else is already in variable MS_RFDIR.
MS_RFDIR > V:/CAD/Projects/Project2/References/
Appends the folder after whatever else is already in variable MS_RFDIR.
Right on! I luckily knew that part, I was worried that in the changes since J(the last time I was on the administrative side) and now, they added actual numeric values. I was out googling and looking at forum stuff to see if I had missed something about numbers. hahaha
Like I mentioned I did try all the append, prepend and equal to values, all with the same result.
One thing that I HOPE does not matter. We are running PowerGEOPAK, the newest version. Configs, VBA use and all should be the same as stand alone Microstation, as PowerGeopak is microstation and Geopak combined.
Config variables:
_HOME = c:/BentleyPaths/
# --- VBA VARIABLES ---
MS_VBASEARCHDIRECTORIES = $(_HOME)automation/VBAapps/
Unknown said:MS_VBASEARCHDIRECTORIES = $(_HOME)automation/VBAapps/
Use MicroStation menu Workspace|Configuration to pop the Configuration dialog. Scroll the left-hand list to the bottom to select the entry for Visual Basic for Applications. In the upper-right pane you can see the variable descriptions: click Directories to search for VBA p and examine the value in the lower-right pane.
Does one of those values for MS_VBASEARCHDIRECTORIES match yours? If not, you may have a problem with GeoPack scribbling over the configuration.
Yes it matches. In fact since I have it still set to 'equal to' that path is the only one shown. Like mentioned before it is finding it as I can go directly to the utilities:macros:macros tool and it is automatically populated in that window. I can run it and all is right with the world. Try keying that thing in and its toast. Thanks for all this effort so far. I appreciate it.
Try step by step:
vba load LoadCharacters
vba run StartChar
Answer Verified By: Robert Hook
Oh wow. That worked?? But why.... kidding. Right now, i don't care why it works. THANKS!!!!
keyin:
vba load LoadCharacters;vba run StartChar
I guess maybe your module name is incorrect. So you can try the key-in "VBA RUN [LoadCharacters]StartChar".
Regards,
YongAn