Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Maintaining formatting - Excel = Word


I am using an excel spreadsheet to enter details into a word document,
but even though a cell is formatted in currency format when I use the
following code....

appWD.Selection.MoveDown Unit:=wdLine, Count:=4
appWD.Selection.MoveLeft Unit:=wdCharacter, Count:=2
appWD.Selection.TypeText Text:=strReference

The text changes from £33.50 in the Excel spreadsheet to 33.5 in the
Word document, any tips?


--
ChrisMattock
------------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...o&userid=33912
View this thread: http://www.excelforum.com/showthread...hreadid=540559

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Maintaining formatting - Excel = Word

Excel DISPLAYS values as formatted, but stores them numerically - so if
you need to send it to the document as a certain format, send it IN
that format

appWD.Selection.TypeText Text:=format(strReference ,"£0.00")

will do what you want

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Maintaining formatting - Excel = Word


I tried that and it came up with a compile syntax error, highlighting
the 3D part of 3D format, and where does the "=A30.00" bit come from?
Sorry don't use VB much...

here is what I have (or part of it)... where strReference is a £0.00
sum

Sub main()
strDate = Cells(2, 1)
strReference = Cells(2, 3)
strFAO = Cells(2, 4)
iquote = Cells(2, 2)
fname$ = InputBox("Save Letter of Acceptance as :")
Cells(3, 3) = "Letter " & fname$ & " issued"

Dim appWD As Word.Application
Set appWD = CreateObject("word.application.8")
appWD.Visible = True
appWD.Documents.Open FileName:="H:\DesktopXP\LOA
Stuff\02\LOA2.doc"
appWD.Selection.TypeText Text:=strDate
appWD.Selection.MoveRight Unit:=wdCharacter, Count:=13
appWD.Selection.TypeText Text:=strReference
appWD.Selection.MoveRight Unit:=wdCharacter, Count:=23
appWD.Selection.TypeText Text:=strFAO
appWD.ActiveDocument.SaveAs FileName:="H:\DesktopXP\LOA Stuff\02\"
& fname$, FileFormat:=wdFormatDocument

appWD.ActiveDocument.Close
appWD.Quit

End Sub


--
ChrisMattock
------------------------------------------------------------------------
ChrisMattock's Profile: http://www.excelforum.com/member.php...o&userid=33912
View this thread: http://www.excelforum.com/showthread...hreadid=540559

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Maintaining formatting - Excel = Word

Might help to do this by email being my
email) but the A30 that you saw was supposed to be a UK pounds sign and
0.00 - basically, put in the format that you want to have in the quotes

  #5   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Maintaining formatting - Excel = Word

Might help to do this by email
It would be great if you could at least update this thread, if you aren't
going to continue resolving things here. That way the rest of us could
learn, too.

Ed

wrote in message
oups.com...
Might help to do this by email being my
email) but the A30 that you saw was supposed to be a UK pounds sign and
0.00 - basically, put in the format that you want to have in the quotes





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Maintaining formatting - Excel = Word

My apologies - my concern was that the formatting wasn't going through
correctly via the group! We've had an exchange of emails, but the ONLY
development is the ability to format a date with ordinal text - not
built into either Word or Excel, but a select case statement along
these lines would handle it

Select Case Day(Now())
Case 1, 21, 31
MsgBox Day(Now()) & "st " & Format(Now(), "mmmm yyyy")
Case 2, 22
MsgBox Day(Now()) & "nd " & Format(Now(), "mmmm yyyy")
Case 3
MsgBox Day(Now()) & "rd " & Format(Now(), "mmmm yyyy")
Case Else
MsgBox Day(Now()) & "th " & Format(Now(), "mmmm yyyy")
End Select

(obviously in the real example, we don't need a message box, and we
only actually need to store the ordinal (string) part as a variable.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
MS Word like formatting in Excel bmac Excel Discussion (Misc queries) 0 May 4th 09 11:31 PM
Maintaining currency formatting in a Mail Merge? Martinson44 Excel Discussion (Misc queries) 2 September 15th 07 09:57 PM
how to keep excel formatting when merging to word? Kelzina Excel Discussion (Misc queries) 1 January 1st 07 09:14 AM
Maintaining Text Formatting in a Lookup loscherland Excel Discussion (Misc queries) 2 April 21st 06 04:26 PM
Maintaining column formatting when copying a row to another sheet based on a value Roger Tapp Excel Programming 3 January 30th 04 08:03 PM


All times are GMT +1. The time now is 10:37 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"