Jumat, 17 Agustus 2012

Re: [MS_AccessPros] Tip of the Week: Coding for PDF in 2003 and 2010

 

You're welcome, Jeff. That's actually the first enumerated argument I've ever seen that was a string.

Bill

--- In MS_Access_Professionals@yahoogroups.com, Jeff Jones <jpjones23@...> wrote:
>
> I agree with A.D. Bill. I would have bet that the value was long and not a regular old string. Pretty cool!!!! Thank you. Jeff
>
> ----- Original Message -----
>
>
>
>
>
> Level: Intermediate (VBA code)
>
> Hi all
>
> It's been way too long since my last TOW, but when I discovered something I
> think is important I thought I should post.
>
> Scenario:
>
> I developed an Access 2002-2003 application that takes advantage of Stephen
> Lebans' PDF writer for reports ( http://www.lebans.com/reporttopdf.htm ) and you
> now have users with Access 2010 running on Windows 7. Guess what. All portrait
> reports won't write to PDF with the DLLs Mr. Lebans uses. They get flipped to
> landscape and the bottom third of each page is cut off. And What's even sadder
> is the new DynaPDF DLL is no longer free.
>
> Solution:
>
> You can code an If block to take advantage of the built-in PDF writer in Access
> 2010. But not directly. This line will not compile in 2003 MDB.
>
> DoCmd.OutputTo acOutputReport, strRptName, _
>
> acFormatPDF, _
>
> strFileName, bolOpenViewer
>
> acFormatPDF is not a known enumeration in 2003. When I first attempted this and
> found out it would not compile I went to my 2010 machine to find the Long value
> of acFormatPDF. I figured I could just use the value and the code would compile.
>
> What I found was rather new to me. The value was not a Long. It was a string.
> The string was:
>
> "PDF Format (*.pdf)"
>
> Hey! That's the same structure that you'd use for a file type filter in a common
> dialog box. So I wrote it up this way:
>
> DoCmd.OutputTo acOutputReport, strRptName, _
>
> "PDF Format (*.pdf)", _
>
> strFileName, bolOpenViewer
>
> And lo and behold, it compiled in my MDB.
>
> Now I had to just write the If block so it would work if the MDB (or MDE) was
> opened in Access 2010 on Windows 7. This did the trick:
>
> If SysCmd(acSysCmdAccessVer) >= 14# Then
>
> DoCmd.OutputTo acOutputReport, strRptName, _
>
> "PDF Format (*.pdf)", _
>
> strFileName, bolOpenViewer
>
> Else
>
> Call ConvertReportToPDF(strRptName, , strFileName, _
>
> False, bolOpenViewer)
>
> End If
>
> I hope you find this useful. Feel free to comment.
>
> Regards,
> Bill Mosca,
> Founder, MS_Access_Professionals
> That'll do IT < http://thatlldoit.com/ > http://thatlldoit.com
> MS Access MVP
>
> < https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E >
> https://mvp.support.microsoft.com/profile=C4D9F5E7-BB03-4291-B816-64270730881E
>
> My Nothing-to-do-with Access blog
>
> < http://wrmosca.wordpress.com > http://wrmosca.wordpress.com
>
> [Non-text portions of this message have been removed]
>
>
>
>
> --
>
>
> Jeffrey Park Jones
> Excel, Access, Word, Office Expert
> Excel and Access, LLC®
> Christopher@...
> http://ExcelAndAccess.Com
> Toll Free 877-392-3539
> Direct Line 714-262-6893
>
> 919-671-9870
> 5109 Deer Lake Trail
> Wake Forest, NC 27587
> jpjones23@...
>
>
>
>
> [Non-text portions of this message have been removed]
>

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar