Erwin Craps - IT Helps
Erwin.Craps at ithelps.be
Wed Apr 13 06:37:54 CDT 2005
I believe this is due to some differences between software. In some application is vbCr (asc code 13) sufficient to start a new line. In some you need vbCr & vbLf (asc code 13 and 10) And in some only vbLf (asc code 10) In excel for a line feed within a cell you need vbLf (asc 10) So you need to the CTRL codes in your fielddata with the appropriate ones for excel. You can do this with the replace function as mailed earlier. For example strFieldData = "abcd" & vbcr & "1234" Cell(1,1) = replace(strFieldData ,vbcr, vblf) Again, you probably need a function because you will have more than one control character to replace. Erwin -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Paul Hartland (ISHARP) Sent: Wednesday, April 13, 2005 1:19 PM To: 'Access Developers discussion and problem solving' Subject: RE: [AccessD] Writing To Excel From Access Code What I mean by CTRL characters is instead of a carriage return, Excel shows a small square box. Sorry for any confusion.. -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Erwin Craps - IT Helps Sent: 13 April 2005 11:58 To: Access Developers discussion and problem solving Subject: RE: [AccessD] Writing To Excel From Access Code Not sure what you mean with CTRL characters? But this may help replace( "123crLfabc","crLf", vblf) OF course you need to create a function to replace all CTRL charachters.... -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of paul.hartland at fsmail.net Sent: Wednesday, April 13, 2005 12:34 PM To: accessd Subject: [AccessD] Writing To Excel From Access Code To all, I have an access database which grabs a certain recordset containing JobNo, StartTime, PrintAddress and EmployeeRole and writes out to an Excel spreadsheet. I am using the following code to put the fields together strDayWork = JobNo & " " & StartTime & vbcrlf & PrintAddress & vbcrlf & EmployeeRole and uses the command .Cells(intExcelRow, intExcelCol) = strDayWork to put the data in the specific cell. The problem is the CTRL characters for the return code also show up in Excel, does anyone know a way of how to remove these from the Excel view. Thanks in advance for all your help.. Paul Hartland -- Whatever you Wanadoo: http://www.wanadoo.co.uk/time/ This email has been checked for most known viruses - find out more at: http://www.wanadoo.co.uk/help/id/7098.htm -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com