This is one I have come up against and worked around, I do not have a need for it now but it is worth asking.
Sort Code = 002333 Excel Sheet Output = 2333
In excel if you were manually entering say bank sort codes or a product that started with a zero you could input '002333 displayed as 002333 the ' denotes it is number as text, but this does not work with the standard code for the Navision Excel Buffer it treats it as text '002333 and not number as text 002333, you cannot seem set the cell type, I have come up against this several times, I do not have the answer, but if anyone else does I would be interested as would others, for later use!
David
Analyst Developer with over 17 years Navision, Contract Status - Busy
Mobile: +44(0)7854 842801
Email:
david.cox@adeptris.com
Twitter:
https://twitter.com/Adeptris
Website:
http://www.adeptris.com0
Answers
When you use in excel the formula =LEFT(A1;LEN(A1)) and A1 has the value '002333 then the ' will be ignored and the formulacel will contain 00233
Perhaps you can use this formula as code for filling the Nav Excel Buffer?
Marcel
you have to format a column/cell as text before you enter values in cells.
I forgot the syntax but it goes something like
Sheet.Range('A:A').Format := '@';
For format types you can open excel and check which are excel strings for that.
for examle,
text is '@'
decimal number is '0,00'
decimal number with dots on thousands '#.##0,00'
That's just it, you have to use a pre formatted spreadsheet or write lots of code, but what I want is to create a new sheet with dynamic formatting, using the Excel Buffer, and the standard functions.
If I type in Excel '002332 I Get "Number as Text" 002332
I want the Navision Buffer to Know that If I export a numeric Value with a leading Zero then it must treat this as "Number as Text" not Text or Numeric when creating the sheet, this may just be an oversight.
I recently had to create a report for a Customer that exported bank details and vat numbers with several different country specific formats, some had leading Zero's, I had to deal with this by prefixing the value with a Tilde ~ then telling the customer they would have to open the spreadsheet, format the column as text, and removing the tilde, but this is hardly nice automation, the Excel Buffer functions should be a little bit more useful giving us the option to choose a format type.
I could have used a dataport, fixed width, tab or csv format, but when you open these in excel it strips the leading zeros, export as txt, open excel and then open in file, this is the only option that gives you a chance to say this column is text to keep the leading zero format.
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
add the '''' + before the field (4 single quotes)
or
http://www.mibuso.com/forum/viewtopic.php?t=4664
or
http://www.mibuso.com/forum/viewtopic.php?t=15911
http://www.BiloBeauty.com
http://www.autismspeaks.org
WorkSheet.Range(<Cell>).NumberFormat := '000000;######';
In this way, it would make sure the length is 6 and kept leading zeros. You can do this is excel cell format too.
The downside of this way is the fixed length.
I just tested it and it works fine, as text and formula, I am sure I did try this before and got the string, I must have put to many '''''' s, I know that 4 '''' is single quote and 6 '''''' is double quote (Speech Marks), oh well it might be useful for other searches!
Mobile: +44(0)7854 842801
Email: david.cox@adeptris.com
Twitter: https://twitter.com/Adeptris
Website: http://www.adeptris.com
Indeed I rarely use excel buffer funcionality but it should not be a problem to add the code in eb, to add functionality such as preformating excel columns for you before entering data so then, you will be able to use standard functions and excel buffer And few lines of code.
Or at least to fix a problem with leading zeroes if that kind of funcionality already exisist.
I am trying to import journal lines from Excel :
but NAV imports G/L accounts as numbers :
Account # in Excel > 10000
Account # in Excel Buffer > 10 000
I can't find how I can use NumberFormat fonction with this ?
Any idea would be great... =D>
Thanks in advance for help !
Jarod