Whenever exporting from Excel to PDF (via Microsoft print to pdf) the resulting pdf file would have different margins from the original shown in Excel print preview. The margins are wider and the size of the page is changed from A4 (as in the Excel file) to Letter. Is there a way to fix this please? thanks
Instead of 'Microsoft Print to PDF' I would recommend using 'Save As', then in the dropdown 'Save as type:' you can chose 'PDF'. This then saves a PDF that (for me) matches the presentation I expect.
Alternatively, if you do want to use 'Microsoft Print to PDF' you could try to go to printer properties (for 'Microsoft Print to PDF'), then select 'Advanced', then check that the 'paper size' dropdown is set to A4.
Related
I have a folder C:\Users\User1\FolderForPDF, and I have Excel workbooks and a Pdf printer with the name of "PdfPrinter1".
After I edit workbook as I need to, I would like to have a macro, that would print first worksheet in my workbook to PDF. I need it to have a name that is in Cell A1 on this first worksheet, and add "_archive" to that (so eg. "worksheet12_archive"). The PDF should be printed to the folder I listed above. The resolution needs to be set to 600. I want it to go through my pdf printer (not through saving as pdf or printing through Microsoft to PDF).
I would like everything to be set in that "Save as" popup window (suggested name, saving folder).
I know about the .ExportAsFixedFormat and this does the job for me for one other specific thing, but for this one I need it to actually go through printing, because this "save as pdf" makes the resolution way bellow my requirement.
Is that possible to acchive or am I looking at something to much for vba?
Hi i am able to open a pdf document and select a specified text from the pdf document, but i want to know location of the selected text in the pdf document like page number and line number of that text.
Is there a function in vba excel which can help me get the location of the selected text in any form be it x,y coordinates or page and line number.
I think, you should use send keys option of vba for this. So whenever your file open then it's, also open pdf file. And once pdf file open then it will open find option by send keys code and serach, find, copy and paste according to your sendkeys code requirement.
I am using OpenXML to create reports, I am filling data in existing excel template file.
In excel template 'Wrap text' for all cells is set to true. When my report is complete I open excel file.
In opened file cells are not sized correctly with text wrapping (text wrapping is not applied). Also I observed on machine with office 2007 it works cell are wrapped but on office 2013 cell are not correctly wrapped. If I just double click on any cell then entire row is correctly updated.
Can someone please help me in this, is any property \tag I can set in openXML so that on document open cells are correctly shown.
Previously we were using OLE office interface there it works always so expectation is it should work with openXML too.
Thanks,
Dhanaj
I was wondering if there is a way to print to pdf. My company has a software installed as a printer (ScanSoft pdf). The reason I need to print as a pdf and not save is as follows:
My default printer can only print letter documents. I have few routines that format the excel document that I am working on to a tabloid document. And the since I my default printer can't support 11x17 (Tabloid). The page breaks are defaulted to letter document settings. And the tabloid is not an option in the size options. If I go and select the print and select a pdf and exit the print dialogue without saving - the page breaks are converted to the tabloid settings. I have another routine that runs through the document and adjusts the page breaks to avoid splitting merged cells.
What I am looking for at end of the day, run the routine to format document, run a routine to print as pdf then exit dialogue (to adjust page breaks), run routine to adjust page breaks, run routine to save pdf.
enter link description here
You just need to set your activeprinter to the pdf printer
Application.ActivePrinter ="what ever your printer is called"
To find out what it's called, set it as the activeprinter manually and then in the immediate window just type
? Application.ActivePrinter
I am looking to automate the conversion of an excel sheet into a pdf document (I do not want to manually print the report generated in excel as a pdf document every morning). For now, I would like to create a button in excel that will run the macro to automatically generate the pdf document, but this button will eventually not be used.
Im also new to VB, but have read up on the AcroEXch SDK. Seems like I should be using AcroEXch.PDDoc.Create, but this is not quite right (because I cannot specify an input file to be printed/created as a new pdf document).
Any ideas on how I can create a brand new pdf file? Thanks in advance.
I think i found the answer. Here is one solution someone at work suggested (if anyone finds it useful, then great).
There is no available method in the AcroEXch class (or set of methods that I know of) to convert a non-pdf file to a pdf file. Instead, you have to use the pdf Distiller to first convert the file to postscript and then you can write to pdf, using the PDFDistiller class. Here's a snippet of the code:
'1. open excel being converted to pdf:
xlReport.activate
xlReport.range("a1").select
dim PdfFilePath
PdfFilePath = ""
dim PsFilePath
PsFilePath = ""
'2. Print Excel file to postscript file
xlBook.activesheet.PrintOut , , 1, , "Adobe PDF on Ne01:" ,TRUE, , PsFilePath
Dim oDistiller
Set oDistiller = CreateObject("PDFDistiller.PDFDistiller.1")
oDistiller.FileToPDF sPsFilePath, sPdfFilePath, ""
' Close Excel - do not save.
'COMMENTED OUT BELOW 3 LINES FOR DEBUG
xlApp.displayalerts=false
xlApp.quit
set xlApp=nothing
I don't know exactly what your circumstance is and what tools you have access to, but reading your description, it sounds like you simply want to have an Excel file converted for you with a click.
It would be helpful if you had posted whether you have Adobo Acrobat Professional, latest version of Excel, or other converters that are available on the market.
If you have Acrobat Pro installed, your office apps (word, excel, outlook, etc) should already have a "Convert to PDF" button in the toolbars, in combination with Excel command line argument it shouldn't be too hard to cook up a Windows Scheduled Task that periodically convert excel files for you.
Have you considered CuteFTP or PDFCreator, both are free. I have sucessfully used PDFCreator with VBA and I have heard that CuteFTP is good.