Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 06-02-2021, 09:41 AM
newb newb is offline Formatting Issue when importing excel data to word Windows 10 Formatting Issue when importing excel data to word Office 2019
Novice
Formatting Issue when importing excel data to word
 
Join Date: Jun 2021
Posts: 3
newb is on a distinguished road
Default 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  
Old 06-02-2021, 04:01 PM
Guessed's Avatar
Guessed Guessed is offline Formatting Issue when importing excel data to word Windows 10 Formatting Issue when importing excel data to word Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Closed Thread

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
Formatting Issue when importing excel data to word Importing Data from Excel - Format of table messed up in Word Table epsulliv Word Tables 6 08-24-2015 07:29 AM
Formatting Issue when importing excel data to word Strange Issue with Excel Linked Data in Word mruetz Word 2 03-19-2015 04:45 PM
Formatting Issue when importing excel data to word Importing & Formatting CSV Data Problems ekeithjohnson Excel 6 08-24-2014 08:32 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft