Hi ALL

am in a process of coding a macro that converts excel to pdf..this has
to perform for an automation process..am almost close to the
result..but need to bypass the savepdf dialogue ..can any body help me
on this...

earlier help is highly appreciated...


   Global Const dhcRegSz = 1
            Public Declare Function RegOpenKeyEx Lib "advapi32.dll"
Alias  "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As
String,ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As
Long) As Long
            Public Declare Function RegSetValueEx  Lib "advapi32.dll"
Alias "RegSetValueExA"  (ByVal hKey As Long, ByVal lpValueName As
String, ByVal dwReserved As Long, ByVal dwType As Long,  pData As Any,
ByVal cbData As Long) As Long
            Public Declare Function RegCloseKey Lib
"advapi32.dll" (ByVal hKey As Long) As Long
            sub MyMacro()
            dim strDefaultPrinter as string, strOutFile as string
            strDefaultPrinter = Application.ActivePrinter
            Application.ActivePrinter = "Adobe PDF on Ne00:"
            lngRegResult = RegOpenKeyEx(dhcHKeyCurrentUser,"Software
\Adobe\Acrobat PDFWriter", 0&, dhcKeyAllAccess, lngResult)
            lngRegResult = RegSetValueEx(lngResult, "bExecViewer",
0&,dhcRegSz, ByVal "0", 1)
            lngRegResult = RegSetValueEx(lngResult, "bDocInfo", 0&,
dhcRegSz,ByVal "0", 1)
            strOutFile = "C:\check.pdf"
            lngRegResult = RegSetValueEx(lngResult, "PDFFileName",
0&,dhcRegSz, ByVal strOutFile, Len(strOutFile))
            lngRegResult = RegCloseKey(lngResult)
            ActiveWindow.SelectedSheets.PrintOut

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
Like our page on facebook , Just follow below link
http://www.facebook.com/pages/discussexcelcom/160307843985936?v=wall&ref=ts

Reply via email to