LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Word to Excel

Hi,

Its been sometime since I posted my queries in this forum. New IT
policy in the compnay, proxy net connection .. i dunno what, but Im not
able to access NG's through Outlook and posting through Google is....

I have some data in word which has to be transfered to Excel
automatically.

Using Jon P's Excel to PPT automation examples I wrote the following
code in Word.

a) Problem is if I have some tables in Word then the table borders dont
get transfered to excel. Is this normal? On the other hand if I
manually copy paste from Word to Excel then do paste special and choose
HTML, one can get borders etc same as Word. if I use the syntax --

oExcelWorkS.Range("a1").PasteSpecial Format:=wdPasteHTML,
Link:=False, DisplayAsIcon:= _
False

then I get Compile error: named argument not found in Format above.

Why am I getting this error? What would be the correct synax?

b) I think my Present code is equivalent to a paste special - text or
unicode text (which one is it?) Whats the different between the 2?

c) In word Iam using early binding to excel and when I write the code
line
-- oExcelWorkS.Range("a1").PasteSpecial -- and immediately after
Pastespecial if I give a space then word prompts with some excel
constants - xlpasteall, xlpasteformats --etc, but when I use any of
these then I get a runtime error at this line (1004) -- paste special
method of range class failed? Why is this happening


Regards,
Hari
India


Option Explicit


Sub TransferDatatoExcel()

'Set the reference to Microsoft Excel 11.0 Object library (or
10.0/9.0 _
depending on your version of Office) in Tools - References

Dim oExcel As Excel.Application
Dim oExcelWorkB As Excel.Workbook
Dim oExcelWorkS As Excel.Worksheet

Dim fileName As Double

Application.ScreenUpdating = False

Selection.WholeStory
Selection.Copy

Set oExcel = CreateObject("excel.application")
oExcel.Visible = msoTrue
Set oExcelWorkB = oExcel.Workbooks.Add
Set oExcelWorkS = oExcelWorkB.Worksheets("sheet1")


oExcelWorkS.Range("a1").PasteSpecial xlPasteValues

fileName = Now()

With oExcelWorkB
.SaveAs "d:\Time Stamp - " & fileName & ".xls"
.Close
End With

oExcel.Quit

Set oExcel = Nothing
Set oExcelWorkB = Nothing
Set oExcelWorkS = Nothing

Application.ScreenUpdating = True

End Sub

 
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
Need Excel count of 1 word if found in multi-word cells of column Function_Challenged Excel Worksheet Functions 1 August 27th 09 12:08 AM
Excel 7, paste linked to word becomes black when word pdf'd Surffreak Excel Discussion (Misc queries) 0 June 1st 08 12:17 AM
Copy from Word to Excel, and retain indent, plus word wrap Eric Excel Discussion (Misc queries) 1 March 9th 07 03:15 AM
Print labels by using Excel data in a Word mail into word Zoey Excel Discussion (Misc queries) 1 November 1st 05 09:08 PM
Printing Word Document using Excel Programming hangs Word Alan Excel Programming 0 September 30th 04 08:41 PM


All times are GMT +1. The time now is 02:24 PM.

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"