This MSaccess report cuts the bottom lines when printing or exporting to pdf.
There are no 'blank' pages produced.
Both printing and export produce a well formated pdf file when run through the GUI menus.
But, when running with code, say:
DoCmd.RunSavedImportExport "ListPost"
or:
DoCmd.OpenReport "ListPost", acViewReport
DoCmd.OutputTo acOutputReport, "", acFormatPDF, "C:\Program Files (x86)\UDD\ListPost.pdf", , , , acExportQualityPrint
will have the problem.
Ideas??!
Related
Is there a way to save a report as an image (.JPG, .GIF, .PNG) in Microsoft Access using this code instead of saving it as .SNP)?
Private Sub Command150_Click()
DoCmd.OutputTo acOutputReport, "Playa1", acFormatSNP,
"C:\Users\Tony\Documents\Testo\pretty.snp"
End Sub
I'd like to save it as pretty.jpg
I want users to be able to put the Project folder on any location of their choice. If I use:
Application.FollowHyperlink ("C:\Program Files(x86)\Project\reference.pdf")
The pdf document launches only if the user put the Project folder in the Program Files(x86) folder. Is there a way for access to refer to the current path instead? I have tried the below code with no luck.
Private Sub referencefile_Click()
Application.FollowHyperlink (".\reference.pdf")
End Sub
I have tried:
Application.FollowHyperlink (CurrentProject.Path & "\reference.pdf"),
NewWindow:=True
This works well with txt files but not with pdf files. Any idea?
After a Quick Check and ensuring that my pdf file was not corrupted.
Application.FollowHyperlink (CurrentProject.Path & "\reference.pdf"), NewWindow:=True
The above code works fine as long as the pdf file exits in the same location as the front end. If you have ever thought of eliminating the security warning that access gives when you manually enter a hyperlink to a control button's properties, this code may be a good solution.
I was trying to export A report from Access to Excel using the code below.
pat = CurrentProject.Path
Set xlo = CreateObject("Excel.Application")
Nname = "MonthlyData" & Left(Now(), 5)
DoCmd.OutputTo acOutputReport, "MonthlyAll", "Excel 97 - Excel 2003 Workbook (*.xls)", pat & "\" & Nname & ".xls", True
It works fine in my system but isn't working on any other I have tried since.
I am not able to export to any other excel formats in my system as well.
I have the following references selected in my system,
Visual Basics for Applications
Microsoft Access 15.0 object Library
OLE Automation
Microsoft Office 15.0 Access database engine object Library
Microsoft Excel 15.0 object Library
Microsoft Office 15.0 object Library
I haven't checked for these references yet.
Not sure if that is the reason. I am using windows 10 which is not the problem. I have checked for compatibility.
You will probably need to use late binding instead of early binding to ensure that whatever version of excel / office is in use your references are created on the fly for the version in use.
This thread will proabably help Convert Early Binding VBA to Late Binding VBA : Excel to Outlook Contacts
You provide the DoCmd.OutputTo parameter OutputFormat as string, this is language-specific.
Use the constant acFormatXLS instead, it should work on all systems.
DoCmd.OutputTo acOutputReport, "MonthlyAll", acFormatXLS, pat & "\" & Nname & ".xls", True
Actually, this won't help. I assumed the constant was a numeric value, but
Const acFormatXLS = "Microsoft Excel (*.xls)"
Note: If I try it with your format string "Excel 97 - Excel 2003 Workbook (*.xls)", it works with a German Office 2010. So this is probably not the problem.
Left(Now(), 5) might introduce illegal characters for file names, depending on the regional settings.
Use e.g. this instead:
Nname = "MonthlyData" & Format(Date(), "yy-mm")
Is it possible to export an access report to a .docx file?
At the moment we export only .pdf but also need the word document
This can easily be accomplished with the Docmd.OutputTo method.
Here is a link to the formal documentation: https://msdn.microsoft.com/en-us/library/office/ff192065.aspx
Here is a one-line example of how I would do it:
Docmd.OutputTo acOutputReport, "rptMyReport", acFormatRTF, "C:\Users\User\Documents\MyExportedReport.rtf"
However, while this method can export it as an rtf (which can be opened in Word), it can't do it as a docx. Does this report need to be converted to that docx format? If so, a little more complicated procedure may need to be involved to accomplish this.
If you have the pdf open with Adobe Acrobat, you can simply save as a Word file.
File > Save as > Microsoft Word > Word Document
The same goes for Microsoft Word if you decide to export it as a RTF file and still want to convert to .doc or .docx.
File > Save as > Word Document
VBA Route:
Exporting a report to word format (.doc & docx) are not supported in the Docmd.OutputTo.
However there looks like there is a method that will work the way you want it to found here: Exporting MS access Report to MS Word using VBA
I have a DoCmd to export a query into an Excel file but when I go to open the Excel file I get an error message stating, "Excel cannot open because the file format and extension is not valid." What can be causing this to happen when I export the file and attempt to open it?
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel9, "qryComplete", "C:\Users\Downloads\Reports\Report_Name " & Format(Date, "mmddyy") & ".xlsx", True
If you want acSpreadsheetTypeExcel9 for the SpreadsheetType option, use .xls as the file extension.
If you want .xlsx as the file extension, use acSpreadsheetTypeExcel12Xml for SpreadsheetType.
The error happens because acSpreadsheetTypeExcel9 and .xlsx is not a valid combination.