#1
|
|||
|
|||
Formatting Issue when importing excel data to word
Hello, I am trying to import data from excel to word. the excel cells that i want transferred are named and i built out tables in word that have the corresponding "cells" bookmarked. for the numeric data, i have an issue. some are percentages, some need two decimals, some i would prefer as whole numbers. the issue is that certain items that i would need 2 decimal places for come through as whole number. so 1.15 comes in as 1. 1.2 as 1. .65 as 1, etc.... i inherited the code for this and tried to edit it but had no luck. does anyone know how i can have the formatting change based on how it is displayed in ecel? also, is there a certain way i should format in excel so that the data transfers as intended? I have posted the excerpt of the code regarding formatting below: Code:
Set cl = item.Range.Cells(1) fValue = RangeValue(itemName) If fValue <> "" Then If IsNumeric(fValue) Then Select Case formatCell Case "Percentage" item.Range.Text = Format(fValue, formatCell) Case "0%" item.Range.Text = Format(fValue, formatCell) Case "0.0%" item.Range.Text = Format(fValue, formatCell) Case "0.00%" item.Range.Text = Format(fValue, formatCell) Case "0.00""x""" item.Range.Text = Format(fValue, "0.00""x""") Case Else item.Range.Text = Format(fValue, "#,##0;(#,##0);"" - """) End Select |
#2
|
||||
|
||||
I suggest a Mod closes this thread - there is another thread here that provides a bit more code with the same issue.
See https://www.msofficeforums.com/word-...requested.html
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
Tags |
formatting |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Importing number data from an Excel spreadsheet into a Word table | Hefty | Word Tables | 1 | 06-07-2017 04:08 AM |
Word Formatting Issue: Space above text when linked to Excel | JDHeisenberg | Word | 3 | 08-19-2016 05:34 AM |
Importing Data from Excel - Format of table messed up in Word Table | epsulliv | Word Tables | 6 | 08-24-2015 07:29 AM |
Strange Issue with Excel Linked Data in Word | mruetz | Word | 2 | 03-19-2015 04:45 PM |
Importing & Formatting CSV Data Problems | ekeithjohnson | Excel | 6 | 08-24-2014 08:32 PM |