JonXL
Well-known Member
- Joined
- Feb 5, 2018
- Messages
- 513
- Office Version
- 365
- 2016
- Platform
- Windows
Hello,
I'm running into an issue with exporting to Excel where two lines within a field show up as one line in the Excel cell. Here's what's happening in detail...
Is anyone aware of a solution to this? I'm thinking something on the lines of a different way to indicate the new line that Excel more happily recognizes would be preferred as the whole export process is pretty set (it's all based on tables for different export jobs and the code behind the exporting is the same for all export jobs on the export table; so I'd prefer a way that just involves modifying the query...).
Any thoughts on how to make the address show up on the Excel output on two lines is appreciated!
Thanks,
Jon
I'm running into an issue with exporting to Excel where two lines within a field show up as one line in the Excel cell. Here's what's happening in detail...
- I'm using
DoCmd.TransferSpreadsheet
to export a query - The query is based on a table with address fields; the fields are separated out into Address line, City, State, and ZIP
- In the query, I combine the address information into a single output with the CSZ (City, State, ZIP) on a separate line with this code:
[Address] & Chr(13) & Chr(10) & [City] & ', ' & [State] & ' ' & [ZIP]
- In the Access query - when viewed in Access - the field looks right with the newline showing the CSZ separate from the Address
- However... in the Excel export, the cell shows them all in one line (as if the query were
[Address] & [City] & ', ' & [State] & ' ' & [ZIP]
), except:- When I click into the cell, they switch to two lines
- If I enter out of the cell, they stay on two lines
Is anyone aware of a solution to this? I'm thinking something on the lines of a different way to indicate the new line that Excel more happily recognizes would be preferred as the whole export process is pretty set (it's all based on tables for different export jobs and the code behind the exporting is the same for all export jobs on the export table; so I'd prefer a way that just involves modifying the query...).
Any thoughts on how to make the address show up on the Excel output on two lines is appreciated!
Thanks,
Jon