Originally Posted by
peterwmartin
Hi all I need some help with formating. I have a word document which I select then paste into excel. The original word doc has been justified centre. The code I have copies and pastes. But is there a way to justify it centre of sheet I still need to be able to change values so I can't copy as picture.
[vba]Private Sub cmdOK_Click()
Dim fd As FileDialog
Dim myPath As String
Dim xlApp As Object
Dim xlBook As Object
Dim xlSheet As Object
'in the background, create an instance of XL
Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
Selection.WholeStory
Selection.Copy
xlSheet.Range("e1").Select
'xlSheet.Paste
xlSheet.PasteSpecial format:="Microsoft Word 8.0 Document Object"
xlApp.Visible = True
Set xlSheet = Nothing
Set xlBook = Nothing
Set xlApp = Nothing
End Sub
[/vba]
Any ideas would be appreciated.
Thanks all