Export the report in Access to PowerPoint and add each page of the report to a slide (1 Viewer)

Mohd87

New member
Local time
Today, 12:48
Joined
Aug 9, 2023
Messages
5
I am amending this rule and then I will transfer the code to my database because it works on the network and I do not have a copy on my computer, and I apologize to the owner of the database I just wanted to apply the amendments, every once in a while my manager at work asks for a PowerPoint presentation although I issue the report in PD F and Excel, but it needs PowerPoint. Please help. The report consists of 6 pages. I need to copy each page into a slide. I tried to copy 3 pages, but the code works, but it only puts the first image in all slides. There may be a problem with adding slides. I don't know with the error, knowing that I I can't use external libraries in Access
 

Attachments

  • FAULTS COMPLAINT.ZIP
    393.7 KB · Views: 52

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:48
Joined
Jul 9, 2003
Messages
16,282
Your post hasn't received a response yet. This might be because it's a unique problem that isn't commonly seen here. To increase your chances of getting assistance, it might be helpful if you provide some of your own work or thoughts on the matter. This way, others can see that you're genuinely looking for guidance and not just a complete solution.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:48
Joined
Feb 28, 2001
Messages
27,186
knowing that I I can't use external libraries in Access

If you don't use the PowerPoint library then you are stuck.

Part of the difficulty is that you will have trouble doing this directly because of what you use as a file output format. Once a report is output as PDF then you need an Adobe external library to break it apart. The Excel output format is no better because I believe the pagination format is virtual, not physical. HOWEVER, if you output the report to either WORD .DOCX format or .RTF format, it would then be possible to open a Word application object and read the report.

Using VBA you could find the first character of the file, then find the next page-break. Declare a range between that first character and the last character before the page break. Output that range to a separate file. Now move to the first character after the page break, and find the NEXT page break. Output that page. Repeat the above process until you reach the end of the report file. Now you have however many pages were in the report as separate WORD files. Open the PowerPoint file as an app object, create a slide, and do a file insertion on that slide anchored to the top-left corner of the slide. Add another slide, insert the next file in sequence. Keep doing that until you run out of separate files.

I can't show you code for that because while I basically understand Office VBA, I've never played with that combination and it might take me a while to research it. But that is the general idea.
 

ebs17

Well-known member
Local time
Today, 13:48
Joined
Feb 7, 2020
Messages
1,946
knowing that I I can't use external libraries in Access
With your actions you are already proving the opposite. External libraries can be used via early binding (reference) or late binding.

I don't know with the error
Code:
DoCmd.OutputTo acOutputReport, "", acFormatPDF, myPath & strReportName, False
Code:
For SlideNo = 1 To 3
    Set shpGraph = PowerPoint.ActivePresentation.Slides.Add(SlideNo, ppLayoutBlank).Shapes.AddOLEObject(Left:=0, _
       Top:=0, Width:=750, Height:=550, _
       FileName:=myPath & strReportName, DisplayAsIcon:=msoFalse, Link:=msoTrue)
Next SlideNo
You're not that far from a solution.

You create a PDF with all pages. To use the pages individually, you would have to split this PDF. This works with various third-party tools such as PDFtk.
Of course, the Acrobat owner can also use the original.
Alternatively, you can create individual reports in a loop and create individual PDFs from them.
The generated individual PDF's should be given logical names for identification.

In the second step you count your PDF's to create the right number of slides. In the loop, the path to the individual PDF must then be assigned as FileName for each slide.
 
Last edited:

Users who are viewing this thread

Top Bottom