Click here to Skip to main content
15,910,877 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Urgent Help Pls With a combobox Pin
Christian Graus1-Jun-05 12:50
protectorChristian Graus1-Jun-05 12:50 
GeneralRe: Urgent Help Pls With a combobox Pin
monica2k1-Jun-05 13:05
monica2k1-Jun-05 13:05 
GeneralRe: Urgent Help Pls With a combobox Pin
Christian Graus1-Jun-05 13:12
protectorChristian Graus1-Jun-05 13:12 
GeneralRe: Urgent Help Pls With a combobox Pin
Member 19629203-Jun-05 21:41
Member 19629203-Jun-05 21:41 
GeneralWindows UserControl in Web Page. Pin
Member 19924701-Jun-05 4:06
Member 19924701-Jun-05 4:06 
Generalmatching code Pin
Member 19982501-Jun-05 3:37
Member 19982501-Jun-05 3:37 
GeneralRe: matching code Pin
Rizwan Bashir1-Jun-05 4:29
Rizwan Bashir1-Jun-05 4:29 
Generalconversion from excel to pdf Pin
Member 19982501-Jun-05 1:54
Member 19982501-Jun-05 1:54 
pls this is my code for conversion of my excel to pdf but it isnt working.dont know where i am going wrong

Sub run()

'
' Makes some preliminary checks of the arguments.
' Quits the application is any problem is found.
End Sub


' ***********************************************
' XLS2PDF
'
' Converts a Excel xlsument to PDF using Adobe
' Distiller.
'
' Input: C:\Documents and Settings\Administrator\Desktop\*.xls
' sXlsFile - Full path to Excel xlsument.
' sPDFFile - Optional full path to output file.
' If not specified the output PDF file
' will be the same as the sXlsFile except
' file extension will be .pdf.
Function XLS2PDF(sXlsFile, sPDFFile)
Dim fso ' As FileSystemObject
Dim wdo ' As Excel.Application
Dim wxls ' As Excel.xlsument
Dim wxlss ' As Excel.xlsuments
Dim sPrevPrinter ' As String
Dim oDistiller ' As PDFDistiller.PDFDistiller.1
Set oDistiller = CreateObject("PDFDistiller.PDFDistiller.1")
If oDistiller Is Nothing Then
WScript.Echo "Error: Cannot create PDF xlsument. Adobe Acrobat " +
"Distiller is not available! Quiting..."
WScript.Quit 1
End If

Set fso = CreateObject("Scripting.FileSystemObject")
Set wdo = CreateObject("Excel.Application")
Set wxlss = wdo.xlsuments

sTempFile = fso.GetSpecialFolder(TemporaryFolder) + "\" + fso.GetTempName()

sXlsFile = fso.GetAbsolutePathName(sXlsFile)

' Debug outputs...
If bShowDebug Then
WScript.Echo "Xls file = '" + sXlsFile + "'"
WScript.Echo "Temporary file = '" + sTempFile + "'"
WScript.Echo "PDF file = '" + sPDFFile + "'"
End If

sFolder = fso.GetParentFolderName(sXlsFile)

If Len(sPDFFile) = 0 Then
sPDFFile = fso.GetBaseName(sXlsFile) + ".pdf"
End If

If Len(fso.GetParentFolderName(sPDFFile)) = 0 Then
sPDFFile = sFolder + "\" + sPDFFile
End If

' Remember current active printer
sPrevPrinter = wdo.ActivePrinter

'wdo.ActivePrinter = "Acrobat PDFWriter"
wdo.ActivePrinter = "Acrobat Distiller"

' Open the Excel xlsument
Set wxls = wxlss.Open(sXlsFile)

' Print the Excel xlsument to the Acrobat Distiller -
' will generate a postscript (.ps) (temporary) file
wdo.ActiveXlsument.PrintOut False, , , sTempFile

' This outcommented part was used while trying to use "Acrobat PDFWriter"
'Do While wdo.BackgroundPrintingStatus > 0
' 'Do nothing - just wait for printing to finish before closing Excel
'Loop

wxls.Close WdDoNotSaveChanges
wdo.ActivePrinter = sPrevPrinter
wdo.Quit WdDoNotSaveChanges
Set wdo = Nothing

' Debug output...
'If bShowDebug Then
WScript.Echo " Distilling to '" + sPDFFile + "'"
'End If

' Distill the postscript file to PDF
oDistiller.FileToPDF sTempFile, sPDFFile, "Print"
Set oDistiller = Nothing

' Delete the temporary postscript file...
fso.DeleteFile (sTempFile)

Set fso = Nothing
MsgBox ("done")
End Function

' *** MAIN **************************************

Call EchoLogo
Call EchoUsage
Call CheckArgs
Call XLS2PDF(arguments.Unnamed.Item(0), arguments.Named.Item("o"))

Set arguments = Nothing
MsgBox ("done")

End Function
MsgBox ("done")
End Sub



GeneralRe: conversion from excel to pdf Pin
Christian Graus1-Jun-05 12:04
protectorChristian Graus1-Jun-05 12:04 
GeneralRe: conversion from excel to pdf Pin
Member 19982501-Jun-05 22:29
Member 19982501-Jun-05 22:29 
GeneralRe: conversion from excel to pdf Pin
Dave Kreskowiak2-Jun-05 6:11
mveDave Kreskowiak2-Jun-05 6:11 
Generaladding dynamic Controls in Panel Pin
Rizwan Bashir1-Jun-05 1:36
Rizwan Bashir1-Jun-05 1:36 
GeneralRe: adding dynamic Controls in Panel Pin
Mandar Patankar1-Jun-05 7:06
Mandar Patankar1-Jun-05 7:06 
GeneralRe: adding dynamic Controls in Panel Pin
Rizwan Bashir1-Jun-05 22:35
Rizwan Bashir1-Jun-05 22:35 
GeneralGot the reason Pin
Rizwan Bashir1-Jun-05 23:22
Rizwan Bashir1-Jun-05 23:22 
GeneralChange color of message box Pin
Rizwan Bashir31-May-05 23:10
Rizwan Bashir31-May-05 23:10 
GeneralRe: Change color of message box Pin
toxcct1-Jun-05 0:35
toxcct1-Jun-05 0:35 
GeneralRe: Change color of message box Pin
Robert Rohde1-Jun-05 11:07
Robert Rohde1-Jun-05 11:07 
Questioncurrent row edit ? Pin
Makniteasy31-May-05 22:20
Makniteasy31-May-05 22:20 
AnswerRe: current row edit ? Pin
Christian Graus31-May-05 22:25
protectorChristian Graus31-May-05 22:25 
GeneralAttaching Database Pin
nitin_ion31-May-05 19:04
nitin_ion31-May-05 19:04 
GeneralRe: Attaching Database Pin
Yulianto.31-May-05 21:15
Yulianto.31-May-05 21:15 
GeneralRe: Attaching Database Pin
Colin Angus Mackay31-May-05 21:56
Colin Angus Mackay31-May-05 21:56 
GeneralRe: Attaching Database Pin
nitin_ion31-May-05 22:22
nitin_ion31-May-05 22:22 
GeneralRe: Attaching Database Pin
Christian Graus31-May-05 22:24
protectorChristian Graus31-May-05 22:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.