Long text displays as ### when format=Text, ok when format=General, but XMLMap resets format to Text

sampr

New Member
Joined
Jul 17, 2007
Messages
45
Hi,
I have a cell in a worksheet that contains long text (500 characters). It has Word wrap set. The data gets displayed fine if the cell format is General. But if the format is set to Text, then the data gets displayed as #######

Here's the problem. I'm loading data for this cell using an XML Map (by calling ImportXML from VB code). This seems to automatically reset the cell format to text. In the XML Map, I've mapped this field using the following definition:
<xsd:element type="xsd:string" name="COMMENTS"/>

Currently the workaround I've done is to reset the cell format in VB code after importing the XML Map, as follows:
Range("Comments").NumberFormat = "General"

Is there a better way to solve this? I would like to avoid writing this kind of code, if possible.

Thanks,
Sam
 
Last edited:

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Any time you copy data, you automatically copy the format. So, using VBA code to do this is probably the only practical way. I think you have it solved.
 
Upvote 0

Forum statistics

Threads
1,214,865
Messages
6,121,988
Members
449,060
Latest member
mtsheetz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top