Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel-VBA and FlexLM
Hi,
We intend to use FlexLM as out licensing system 'behind' Excel-VBA. FlexLM is basically a bunch of dll's and a number of API calls. The thing is that in my VBA code left, right and centre I use the "End" statement (Yes, I know it is bad programming style - but it is kind of inherited). The problem is that this End statement not only clears all the VBA variables, but it seems to clear the FlexLM memory also!! Basically if, upon closing my workbook, I pass the license key back to the dll (this license key I temporarily store in a workbook name, so is *not* cleared by the End statement), the dll falls over if an End statement has been executed, whereas it happily accepts the license key if End is not executed. Is there any way around this? (other then going through tens of thousands of lines of code to get rid of the End statement). For instance, is there a way to stop Excel execution without clearing the workspace (incidentally, "Stop" doesn't do the job of course). Or is there a way of loading the FlexLM dll's in such a way that they are unaffected by the End statement. Or maybe you have anoather idea? Look forward to your reply. Cheers - Michel Kemper - London |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel-VBA and FlexLM
Hi Michel,
I think its worse than that: using End not only kills your VBA variables, it kills everyone else's object variables as well, including all Application level events. So many other Excel addins that have been loaded will probably crash. So I suspect the only solution is to replace all the END statements. Charles ______________________ Decision Models The Excel Calculation Site www.DecisionModels.com "Michel Kemper" wrote in message . .. Hi, We intend to use FlexLM as out licensing system 'behind' Excel-VBA. FlexLM is basically a bunch of dll's and a number of API calls. The thing is that in my VBA code left, right and centre I use the "End" statement (Yes, I know it is bad programming style - but it is kind of inherited). The problem is that this End statement not only clears all the VBA variables, but it seems to clear the FlexLM memory also!! Basically if, upon closing my workbook, I pass the license key back to the dll (this license key I temporarily store in a workbook name, so is *not* cleared by the End statement), the dll falls over if an End statement has been executed, whereas it happily accepts the license key if End is not executed. Is there any way around this? (other then going through tens of thousands of lines of code to get rid of the End statement). For instance, is there a way to stop Excel execution without clearing the workspace (incidentally, "Stop" doesn't do the job of course). Or is there a way of loading the FlexLM dll's in such a way that they are unaffected by the End statement. Or maybe you have anoather idea? Look forward to your reply. Cheers - Michel Kemper - London |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel-VBA and FlexLM
Charles,
I suspected as much, ... but there is always hope, hence my question! Two related questions: 1. Is 'End' the only statement that wipes the memory, or are there other situations that cause the memory to be cleared? 2. I will have to search for 'End' throughout my code. The problem is that I will find 10000's of 'End' strings a la 'End If' and 'End With' etc. Do you know of a way to find only 'End' and not 'End If' etc? Cheers - Michel. "Charles Williams" wrote in message ... Hi Michel, I think its worse than that: using End not only kills your VBA variables, it kills everyone else's object variables as well, including all Application level events. So many other Excel addins that have been loaded will probably crash. So I suspect the only solution is to replace all the END statements. Charles ______________________ Decision Models The Excel Calculation Site www.DecisionModels.com "Michel Kemper" wrote in message . .. Hi, We intend to use FlexLM as out licensing system 'behind' Excel-VBA. FlexLM is basically a bunch of dll's and a number of API calls. The thing is that in my VBA code left, right and centre I use the "End" statement (Yes, I know it is bad programming style - but it is kind of inherited). The problem is that this End statement not only clears all the VBA variables, but it seems to clear the FlexLM memory also!! Basically if, upon closing my workbook, I pass the license key back to the dll (this license key I temporarily store in a workbook name, so is *not* cleared by the End statement), the dll falls over if an End statement has been executed, whereas it happily accepts the license key if End is not executed. Is there any way around this? (other then going through tens of thousands of lines of code to get rid of the End statement). For instance, is there a way to stop Excel execution without clearing the workspace (incidentally, "Stop" doesn't do the job of course). Or is there a way of loading the FlexLM dll's in such a way that they are unaffected by the End statement. Or maybe you have anoather idea? Look forward to your reply. Cheers - Michel Kemper - London |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel-VBA and FlexLM
Hi Michel,
AFAIK its the only statement, but anything that resets the VB environment will also do it (ie changing code in debug). I am sure you could easily write a routine using the VBE object model to scan for END and ignore END IF etc: but there are a lot of people who are cleverer than me at programming the VBE. If you want to go that route look at Rob Bovey's response to a post of mine earlier today, and also check out Chip pearson's site on manipulating the VBE. And stephen Bullen has an excellent chapter in Excel 2002 programmers reference. hth Charles ______________________ Decision Models The Excel Calculation Site www.DecisionModels.com "Michel Kemper" wrote in message ... Charles, I suspected as much, ... but there is always hope, hence my question! Two related questions: 1. Is 'End' the only statement that wipes the memory, or are there other situations that cause the memory to be cleared? 2. I will have to search for 'End' throughout my code. The problem is that I will find 10000's of 'End' strings a la 'End If' and 'End With' etc. Do you know of a way to find only 'End' and not 'End If' etc? Cheers - Michel. "Charles Williams" wrote in message ... Hi Michel, I think its worse than that: using End not only kills your VBA variables, it kills everyone else's object variables as well, including all Application level events. So many other Excel addins that have been loaded will probably crash. So I suspect the only solution is to replace all the END statements. Charles ______________________ Decision Models The Excel Calculation Site www.DecisionModels.com "Michel Kemper" wrote in message . .. Hi, We intend to use FlexLM as out licensing system 'behind' Excel-VBA. FlexLM is basically a bunch of dll's and a number of API calls. The thing is that in my VBA code left, right and centre I use the "End" statement (Yes, I know it is bad programming style - but it is kind of inherited). The problem is that this End statement not only clears all the VBA variables, but it seems to clear the FlexLM memory also!! Basically if, upon closing my workbook, I pass the license key back to the dll (this license key I temporarily store in a workbook name, so is *not* cleared by the End statement), the dll falls over if an End statement has been executed, whereas it happily accepts the license key if End is not executed. Is there any way around this? (other then going through tens of thousands of lines of code to get rid of the End statement). For instance, is there a way to stop Excel execution without clearing the workspace (incidentally, "Stop" doesn't do the job of course). Or is there a way of loading the FlexLM dll's in such a way that they are unaffected by the End statement. Or maybe you have anoather idea? Look forward to your reply. Cheers - Michel Kemper - London |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|