Print conditional formatting (1 Viewer)

Kayleigh

Member
Local time
Today, 23:10
Joined
Sep 24, 2020
Messages
706
I have code to export my (datasheet) form to RTF format which works nicely. However the conditional formatting is not showing up. Is there anything I can add to this?
Code:
Private Sub cmdExport_Click()

   Dim Fldr As String

   With Application.FileDialog(4)
      .AllowMultiSelect = False
      If .show <> -1 Then Exit Sub
      Fldr = .SelectedItems(1)
   End With
  
DoCmd.OutputTo acOutputForm, Me.Name, acFormatRTF, Fldr & "\" & Me.txtTitle & ".rtf", True, , , acExportQualityPrint

End Sub
 

theDBguy

I’m here to help
Staff member
Local time
Today, 16:10
Joined
Oct 29, 2018
Messages
21,358
I could be wrong, but I think you can only export the data, not it's formatting.

If you want to format the exported data, you will probably have to do it one row at a time.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 19:10
Joined
Feb 19, 2002
Messages
42,977
Forms are not optimized for printing. Try exporting a report. WHY does the target have to be RTF? Can't you export as a PDF?
 

Kayleigh

Member
Local time
Today, 23:10
Joined
Sep 24, 2020
Messages
706
RTF is easily editable in a Word application. Was considering Excel as well possibly.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 19:10
Joined
Feb 19, 2002
Messages
42,977
So, you want to allow them to edit the report you create? Usually we export reports to PDF to avoid that possibility. If the users want to do more analysis, we export to Excel. Excel is much easier to format using VBA than RTF would be.
 

Kayleigh

Member
Local time
Today, 23:10
Joined
Sep 24, 2020
Messages
706
So conditional formatting would be possible when exporting to Excel?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 19:10
Joined
Feb 19, 2002
Messages
42,977
You can create an Excel template and export the data into that or you can just use VBA to build the whole thing, including conditional formatting. I don't know how though. When I need to figure out how to do something in VBA, I open Excel, turn on the macro recorder, and look at the code it generates. Then I copy that code into Access. Sometimes I need to modify it to adjust object references.
 

Users who are viewing this thread

Top Bottom