vba compiler operation
Can anyone tell me if the vba compiler compiles all the code in every module
at once for a workbook, or does it compile the code in the modules as they are called? Can I place code that will not work on all computers in a module by itself, and have Excel still operate without compiler errors if the module containing the offending code is not called? I have code for creating pdf files that works on computers with PDF Distiller. I want to have the code available to those computers, but still run without compiler errors on computers without PDF Distiller. |
vba compiler operation
If don't force a compile by doing it manually, then this should work.
-- Regards, Tom Ogilvy "joeeng" wrote: Can anyone tell me if the vba compiler compiles all the code in every module at once for a workbook, or does it compile the code in the modules as they are called? Can I place code that will not work on all computers in a module by itself, and have Excel still operate without compiler errors if the module containing the offending code is not called? I have code for creating pdf files that works on computers with PDF Distiller. I want to have the code available to those computers, but still run without compiler errors on computers without PDF Distiller. |
vba compiler operation
I have seen issues with code that does not compile doing odd things. Why not
make the code work on all systems whether they have the distiller or not. I assume the issue is with missing references. If that is the case then use late binding instead of early binding and check to see if all is well... dim Distiller as object on error resume next set distiller = CreateObject("MyDistiller") on error goto 0 if distiller is nothing then msgbox "No PDF..." else msgbox "PDF to your hearts content..." end if -- HTH... Jim Thomlinson "joeeng" wrote: Can anyone tell me if the vba compiler compiles all the code in every module at once for a workbook, or does it compile the code in the modules as they are called? Can I place code that will not work on all computers in a module by itself, and have Excel still operate without compiler errors if the module containing the offending code is not called? I have code for creating pdf files that works on computers with PDF Distiller. I want to have the code available to those computers, but still run without compiler errors on computers without PDF Distiller. |
vba compiler operation
I would like to have the Acrobat Distiller reference selected as default, but
not get compiler errors on computers that do not have it installed. If I understand your answer, you suggest having Acrobat Distiller reference not selected as default and force the user to make the selection in order to get it to work. Am I understanding correctly? I really would like to go the opposite way though. Another alternative, can I programmatically check to see if the Distiller is present on the computer and then programmatically select/unselect the reference accordingly? "Jim Thomlinson" wrote: I have seen issues with code that does not compile doing odd things. Why not make the code work on all systems whether they have the distiller or not. I assume the issue is with missing references. If that is the case then use late binding instead of early binding and check to see if all is well... dim Distiller as object on error resume next set distiller = CreateObject("MyDistiller") on error goto 0 if distiller is nothing then msgbox "No PDF..." else msgbox "PDF to your hearts content..." end if -- HTH... Jim Thomlinson "joeeng" wrote: Can anyone tell me if the vba compiler compiles all the code in every module at once for a workbook, or does it compile the code in the modules as they are called? Can I place code that will not work on all computers in a module by itself, and have Excel still operate without compiler errors if the module containing the offending code is not called? I have code for creating pdf files that works on computers with PDF Distiller. I want to have the code available to those computers, but still run without compiler errors on computers without PDF Distiller. |
vba compiler operation
http://support.microsoft.com/default...b;en-us;245115 INFO: Using Early Binding and Late Binding in Automation http://support.microsoft.com/default...b;EN-US;244167 INFO: Writing Automation Clients for Multiple Office Versions http://support.microsoft.com/?id=160647 XL97: How to Programmatically Create a Reference -- Regards, Tom Ogilvy "joeeng" wrote: I would like to have the Acrobat Distiller reference selected as default, but not get compiler errors on computers that do not have it installed. If I understand your answer, you suggest having Acrobat Distiller reference not selected as default and force the user to make the selection in order to get it to work. Am I understanding correctly? I really would like to go the opposite way though. Another alternative, can I programmatically check to see if the Distiller is present on the computer and then programmatically select/unselect the reference accordingly? "Jim Thomlinson" wrote: I have seen issues with code that does not compile doing odd things. Why not make the code work on all systems whether they have the distiller or not. I assume the issue is with missing references. If that is the case then use late binding instead of early binding and check to see if all is well... dim Distiller as object on error resume next set distiller = CreateObject("MyDistiller") on error goto 0 if distiller is nothing then msgbox "No PDF..." else msgbox "PDF to your hearts content..." end if -- HTH... Jim Thomlinson "joeeng" wrote: Can anyone tell me if the vba compiler compiles all the code in every module at once for a workbook, or does it compile the code in the modules as they are called? Can I place code that will not work on all computers in a module by itself, and have Excel still operate without compiler errors if the module containing the offending code is not called? I have code for creating pdf files that works on computers with PDF Distiller. I want to have the code available to those computers, but still run without compiler errors on computers without PDF Distiller. |
vba compiler operation
How do I determine what to substitute for "MyDistiller" in the CreateObject
statement below? "Tom Ogilvy" wrote: http://support.microsoft.com/default...b;en-us;245115 INFO: Using Early Binding and Late Binding in Automation http://support.microsoft.com/default...b;EN-US;244167 INFO: Writing Automation Clients for Multiple Office Versions http://support.microsoft.com/?id=160647 XL97: How to Programmatically Create a Reference -- Regards, Tom Ogilvy "joeeng" wrote: I would like to have the Acrobat Distiller reference selected as default, but not get compiler errors on computers that do not have it installed. If I understand your answer, you suggest having Acrobat Distiller reference not selected as default and force the user to make the selection in order to get it to work. Am I understanding correctly? I really would like to go the opposite way though. Another alternative, can I programmatically check to see if the Distiller is present on the computer and then programmatically select/unselect the reference accordingly? "Jim Thomlinson" wrote: I have seen issues with code that does not compile doing odd things. Why not make the code work on all systems whether they have the distiller or not. I assume the issue is with missing references. If that is the case then use late binding instead of early binding and check to see if all is well... dim Distiller as object on error resume next set distiller = CreateObject("MyDistiller") on error goto 0 if distiller is nothing then msgbox "No PDF..." else msgbox "PDF to your hearts content..." end if -- HTH... Jim Thomlinson "joeeng" wrote: Can anyone tell me if the vba compiler compiles all the code in every module at once for a workbook, or does it compile the code in the modules as they are called? Can I place code that will not work on all computers in a module by itself, and have Excel still operate without compiler errors if the module containing the offending code is not called? I have code for creating pdf files that works on computers with PDF Distiller. I want to have the code available to those computers, but still run without compiler errors on computers without PDF Distiller. |
vba compiler operation
Perhaps:
Dim MyDistiller As Object Set MyDistiller = CreateObject("PdfDistiller.PdfDistiller.1") MyDistiller.FileToPdf "f:\my.ps", "", "" -- Regards, Tom Ogilvy "joeeng" wrote in message ... How do I determine what to substitute for "MyDistiller" in the CreateObject statement below? "Tom Ogilvy" wrote: http://support.microsoft.com/default...b;en-us;245115 INFO: Using Early Binding and Late Binding in Automation http://support.microsoft.com/default...b;EN-US;244167 INFO: Writing Automation Clients for Multiple Office Versions http://support.microsoft.com/?id=160647 XL97: How to Programmatically Create a Reference -- Regards, Tom Ogilvy "joeeng" wrote: I would like to have the Acrobat Distiller reference selected as default, but not get compiler errors on computers that do not have it installed. If I understand your answer, you suggest having Acrobat Distiller reference not selected as default and force the user to make the selection in order to get it to work. Am I understanding correctly? I really would like to go the opposite way though. Another alternative, can I programmatically check to see if the Distiller is present on the computer and then programmatically select/unselect the reference accordingly? "Jim Thomlinson" wrote: I have seen issues with code that does not compile doing odd things. Why not make the code work on all systems whether they have the distiller or not. I assume the issue is with missing references. If that is the case then use late binding instead of early binding and check to see if all is well... dim Distiller as object on error resume next set distiller = CreateObject("MyDistiller") on error goto 0 if distiller is nothing then msgbox "No PDF..." else msgbox "PDF to your hearts content..." end if -- HTH... Jim Thomlinson "joeeng" wrote: Can anyone tell me if the vba compiler compiles all the code in every module at once for a workbook, or does it compile the code in the modules as they are called? Can I place code that will not work on all computers in a module by itself, and have Excel still operate without compiler errors if the module containing the offending code is not called? I have code for creating pdf files that works on computers with PDF Distiller. I want to have the code available to those computers, but still run without compiler errors on computers without PDF Distiller. |
All times are GMT +1. The time now is 02:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com