Greetings, There is a way to do this- the syntax below is not exactly correct for use inside BWS - but you'll see from my example that it's actually pretty close
Here's a full implementation that shows how to do what you're asking about-in this case it will import a module. http://www.bostonworkstation.com/customer_center/script_center/script_detail s.aspx?id=250 <http://www.bostonworkstation.com/customer_center/script_center/script_detai ls.aspx?id=250&cat=14> &cat=14 Within our Projects, you do have access to the full VBE object. Note that this gives very powerful access to your script code. This is an undocumented feature so "Covering My @#$%" if you mess something up J Regards, Thom Thom C. Blackwell Product Manager Boston Software Systems (866) 653-5105 ex 807 www.bossoft.com <http://www.bossoft.com/> Visit us in Booth 2471 at HIMSS08 - February 25-28 in Orlando, FL Sign <http://www.bostonworkstation.com/customer_center/special_events.aspx> up for my weekly webinar! LEGAL NOTICE Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately, then delete this message and empty from your trash. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Neal Quinn Sent: Thursday, January 31, 2008 5:12 PM To: [email protected] Subject: Re: [Talk] LoadScript Routine Thom: The line Application.VBE.ActiveProjects.VBComponents.Import ("path/name of module") works in Excel, but appears to have a problem in BWS. The Microsoft knowledge database points to a security issue if it doesn't work in Excel. If this is a case of upgrading the security in BWS, perhaps this could be put in the hopper for the next release. This would allow a straightforward use of reusable code in a common repository. The Import and Remove methods could both be used to access the most recent common code. The Remove at the end of the script would be used to require a reload upon startup, thereby ensuring current common code. Neal Quinn Montefiore Medical Center ----- Original Message ----- From: Thom C. Blackwell <mailto:[EMAIL PROTECTED]> To: [email protected] Sent: Thursday, January 31, 2008 1:53 PM Subject: RE: [Talk] LoadScript Routine Greetings, I was worried about that myself - just tried it by adding Shutdown=true to the loadscript. It appears that when the import happens, it also "saves" the project. Regards, Thom Thom C. Blackwell Product Manager Boston Software Systems (866) 653-5105 ex 807 www.bossoft.com Visit us in Booth 2471 at HIMSS08 - February 25-28 in Orlando, FL Sign <http://www.bostonworkstation.com/customer_center/special_events.aspx> up for my weekly webinar! LEGAL NOTICE Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately, then delete this message and empty from your trash. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lawrence, Mitchell Sent: Thursday, January 31, 2008 12:29 PM To: [email protected] Subject: RE: [Talk] LoadScript Routine Ok. I think I might see a way to make it as painless as possible then. I've got a default project that is in a central location. I could move the base functions in that project from the main module into a "Common" module, then also copy/paste everything in that module into a Common.bas file in the same directory as the default project. When I do my updates or new additions to the "Common" module, I could just do them in the default project and the Common.bas file and then run the loadScript (I'll likely rename it. heh.) to update the "Common" module in each region's project from the Common.bas, right? Or am I misreading this. Does the Common module get updated and the project saved??? If it doesn't then I don't really see the whole point of the loadScript. Thank you, Mitch Lawrence Lead Applications Analyst Technical Support - NPR/Automation CHRISTUS Information Management T: <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] Send a " <http://intranet.christushealth.org/spiritBuck/Default.asp> thank you" to someone! _____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thom C. Blackwell Sent: Thursday, January 31, 2008 10:57 AM To: [email protected] Subject: RE: [Talk] LoadScript Routine Greetings, Mitch and I exchanged some further emails-figured I'd respond to the group what is going on. Here's the problem. When VB runs a sub routine, it does a quick syntax check of that routine. Since the Common module has not been loaded, there is no such sub routine as PopupScreen in the project, so VB will rightfully generate a Sub or Function Not Found error. There is not a way to do an "Include" in VB (well at least I don't know how and I've asked folks who would know) - where you just say hey- I am going to call a sub routine - yeah it's not here now, but I'm going to get it from here so VB, it's ok chill out. So this importing stuff is not <exactly> the answer you are looking for. Here's my suggestion. The importing is useful if you are going to be modifying the common module and want those changes to "automatically" update across multiple projects (so a common login routine for example and you need to change menu options etc. But. You will have to have import the module when you start development in the new project (which you'd need to do anyhow for building /testing your script). If every single script you are ever going to create will need this code(or most will anyhow) you could create yourself a "shell project" that has the code you want in it. Put the LoadScript routine in its own module, and have the Common.bas in there as well. Then save this project as Default.BWS in c:\bss70. Then rename it using windows explorer to Default.BWD and voila every new project you build will have this code. It will still be up to the script to call LoadScript. Regards, Thom Thom C. Blackwell Product Manager Boston Software Systems (866) 653-5105 ex 807 www.bossoft.com <http://www.bossoft.com/> Visit us in Booth 2471 at HIMSS08 - February 25-28 in Orlando, FL Sign <http://www.bostonworkstation.com/customer_center/special_events.aspx> up for my weekly webinar! LEGAL NOTICE Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately, then delete this message and empty from your trash. From: Lawrence, Mitchell [mailto:[EMAIL PROTECTED] Sent: Thursday, January 31, 2008 11:42 AM To: Thom C. Blackwell Subject: RE: LoadScript Routine Here is what I have right now. Common.bas is located in C:\ Thank you, Mitch Lawrence Lead Applications Analyst Technical Support - NPR/Automation CHRISTUS Information Management T: <mailto:[EMAIL PROTECTED]> [EMAIL PROTECTED] Send a " <http://intranet.christushealth.org/spiritBuck/Default.asp> thank you" to someone! _____ From: Thom C. Blackwell [mailto:[EMAIL PROTECTED] Sent: Thursday, January 31, 2008 10:38 AM To: Lawrence, Mitchell Subject: LoadScript Routine Greetings, Does your project have this code in the scripts module? I'm going to lobby for this to be a command btw. because now each project that needs to load the common module also needs to have this code (which would not be in c:\ Common.bas). Regards, Thom Sub loadScripts() Dim p As Object Set p = Share("VBProject").VBE.VBProjects(1) 'Remove old code myimport = "Common" For i = 1 To p.VBComponents.Count If InStr(p.VBComponents.Item(i).Name, myimport) Then p.VBComponents.Item(i).Name = "temp" p.VBComponents.Remove p.VBComponents.Item(i) Share("VBProject").VBE.CommandBars("Standard").Controls(3).Execute End If Next i p.VBComponents.Import "c:\Common.bas" Share("VBProject").VBE.CommandBars("Standard").Controls(3).Execute End Sub Thom C. Blackwell Product Manager Boston Software Systems (866) 653-5105 ex 807 www.bossoft.com <http://www.bossoft.com/> Visit us in Booth 2471 at HIMSS08 - February 25-28 in Orlando, FL Sign <http://www.bostonworkstation.com/customer_center/special_events.aspx> up for my weekly webinar! LEGAL NOTICE Unless expressly stated otherwise, this message is confidential and may be privileged. It is intended for the addressee(s) only. Access to this E-mail by anyone else is unauthorized. If you are not an addressee, any disclosure or copying of the contents of this E-mail or any action taken (or not taken) in reliance on it is unauthorized and may be unlawful. If you are not an addressee, please inform the sender immediately, then delete this message and empty from your trash.
<<image001.jpg>>
