functionsmodule
function rdb_create_pdf(source as object, fixedfilepathname as string, _
overwriteiffileexist as boolean, openpdfafterpublish as boolean) as string
dim fileformatstr as string
dim fname as variant
if dir(environ("commonprogramfiles") & "\microsoft shared\office" _
& format(val(application.version), "00") & "\exp_pdf.dll") <> "" then
if fixedfilepathname = "" then
fileformatstr = "pdf files (*.pdf), *.pdf"
fname = application.getsaveasfilename(format(now, "yyyy mm dd") & "_" & range("k3") & "_" & range("d6"), filefilter:=fileformatstr, _
title:="create pdf")
if fname = false then exit function
else
fname = fixedfilepathname
end if
if overwriteiffileexist = false then
if dir(fname) <> "" then exit function
end if
on error resume next
source.exportasfixedformat _
type:=xltypepdf, _
filename:=fname, _
quality:=xlqualitystandard, _
includedocproperties:=true, _
ignoreprintareas:=false, _
openafterpublish:=openpdfafterpublish
on error goto 0
if dir(fname) <> "" then rdb_create_pdf = fname
end if
end function
function rdb_mail_pdf_outlook(filenamepdf as string, strto as string, _
strcc as string, strbcc as string, strsubject as string, _
signature as boolean, send as boolean, strbody as string)
dim outapp as object
dim outmail as object
set outapp = createobject("outlook.application")
set outmail = outapp.createitem(0)
on error resume next
with outmail
if signature = true then .display
.to = strto
.cc = strcc
.bcc = strbcc
.subject = strsubject
.htmlbody = strbody & "<br>" & .htmlbody
.attachments.add filenamepdf
if send = true then
.send
else
.display
end if
end with
on error goto 0
set outmail = nothing
set outapp = nothing
end function[/quote]