vba compiler operation

G

Guest

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.
 
G

Guest

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
 
G

Guest

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?
 
G

Guest

How do I determine what to substitute for "MyDistiller" in the CreateObject
statement below?
 
T

Tom Ogilvy

Perhaps:

Dim MyDistiller As Object
Set MyDistiller = CreateObject("PdfDistiller.PdfDistiller.1")
MyDistiller.FileToPdf "f:\my.ps", "", ""
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top