|
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
|
|
|
|
|
I love these 'it doesn't work' questions. What does it do wrong ? Have you contacted the people who wrote your PDF library ? Have you looked at their samples ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
will they give me the object name to be referenced?
|
|
|
|
|
Probably not, considering it's your code that is not creating the object. Have you stepped through your code, one line at a time and followed what it's actually doing? What line does the error show up on?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hello there
the scenario is that I am fetching list of tables from database. and based on those tables I have to create a list of controls. like textboxes and labels to represent each data field. The form is dynamic with one combo box on top having all tables of Database in it.
now when user selects the other table it has to clear the list of controls and add a new set according to that selected table ( working fine upto now)
Problem ::: the size of panel is fixed and I have turned the auto scroll property to true. now when the table has more fields then scrollbar should come. but what is happening is if the big table is selected on the form load then it works fine. but once the form is loaded and then you change the table, then scroll bar does not appear and fields in last merge togather
any solution ????
|
|
|
|
|
HI Rizwan
From what i have understood you are adding controls to panel on a table select.If you are selecting this table from the dropdownlist.So you need to remove all previously added controls from the panel in the selectedindex event of the combobox
the code can be as follows
'where pnOutputs is the panel control
Dim NoControls As Integer = pnOutputs.Controls.Count
For i = 0 To NoControls - 1
pnOutputs.Controls.RemoveAt(0)
Next
once all the controls from the panel are removed u can add the new controls to the same panel control. I hope this is useful
Mandar Patankar
Microsoft Certified professional
|
|
|
|
|
well thanks for the code. some how i was doing the same thing. the problem is coming when the new controls are added and if they are more , Then the scroll bar does not come on the panel I dont know why ?
can you suggest any thing in this direction
thanks again for the code
|
|
|
|
|
well I was making achor =right for the newly added control. some how I removed it during testing and it started working fine. so if controls adding dynamically have anchor on it then scroll bar for parent control will not come..
cheers.......
|
|
|
|
|
Hye there
I wanted to change the color of Message box plus if possible wanted to change the text of buttons .
any comments ??
|
|
|
|
|
no way...
you have to make your own one if you want such behavior.
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
As already stated the default message box wont do that (not without really hacking it ). Have a look at this article for another one. Free definable buttons are already included and as you have the sourcecode its only a small step towards colored boxes.
|
|
|
|
|
c is the variable for my datagrid current row index. when c is gotten by the dataset it is shown in textboxes. if i edit this row how do i get the datagrid/ table to accept the changes to that row?
Makniteasy
|
|
|
|
|
You can edit the row within the datagrid, or you can remember a primary key for the row, use it to do an UPDATE, and then rebind.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have an application using sql server database. Now i want to ship database along with my application.
First I thought of running a script on the client machine, but then the data would not be copied. Also I have assigned a job on that database, that would not be copied either.
Is there a way that I can create an application which can DETACH and ATTACh database and the JOB assigned to the database.
Thanx in adv
|
|
|
|
|
nitin_ten wrote:
but then the data would not be copied
You can export the data into text file, and then import it from the client's machine. This can be done by creating DTS package.
For attach and detach. [^]. You can execute stored procedure.
<italic>Work hard, Work effectively.
|
|
|
|
|
|
But the default users are the same for every database is'nt it?
|
|
|
|
|
So your database has no security at all then ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
|
Bingo!
This is something i've not been able to achieve, and also how to replicate the job assigned to the database
|
|
|
|
|
How can i programatically create user, assign roles and create job for the database
|
|
|
|
|
|
|
hello there
If you want to do it all programatically then the best way is to use SQLDMO type library and with this you can do every thing on the server.
for this I am not sure it will work with vb.net or not. but it works fine with vb6 where I tested long time back..... here is the link which will help you
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnacc2k/html/msdedeploy.asp
|
|
|
|
|
Is it possible in visual basic if we have a checkbox and on click of a checkbox a combobox is set visible true and this combbox automatically dropdown showing all the values. i just want that combox should open automatically when a checkbox is checked to show all the list. i donot want the user to click on the combo to see what is in the combo.
Is this possible ????????
Any help will be highly appreciated
Thanks in advance
Monica
|
|
|
|