|
-
Jan 24th, 2005, 01:07 AM
#1
Thread Starter
Fanatic Member
copying data from excel to word
HI!!
how can i copy all data from excel to word along with the cells?
Thanks and Regards
Vivek.s
-
Jan 24th, 2005, 02:00 AM
#2
Fanatic Member
Re: copying data from excel to word
i just did a little test in excell and word, i saved a .xls file and oppened it in word, and it oppened succesfully!
so what do you mean?
PS: unless you plan on somehow making a poject relating to this subject please dont cross-thred
-
Jan 24th, 2005, 02:04 AM
#3
Thread Starter
Fanatic Member
Re: copying data from excel to word
hi!
can u post that code.........?
thanks and regards
vivek.s
-
Jan 24th, 2005, 02:05 AM
#4
Re: copying data from excel to word
just save it in excel, and open it in word. no code required.
-
Jan 24th, 2005, 02:12 AM
#5
Thread Starter
Fanatic Member
Re: copying data from excel to word
hi sorry........i wud like to copy data in sheet1 along with the cells(in a table) using my vb code.....
regards
vivek.s
-
Jan 24th, 2005, 02:15 AM
#6
Re: copying data from excel to word
my copy of word will open spreadsheets.
-
Jan 24th, 2005, 02:32 AM
#7
Fanatic Member
Re: copying data from excel to word
why dont you just use:
Shell("C:\Program Files\Microsoft Office\Office\WINWORD.EXE book1.xls")
-
Jan 24th, 2005, 03:22 AM
#8
Thread Starter
Fanatic Member
Re: copying data from excel to word
hi!
i opened excel from word but i get following output
Code:
†††††††††††††††††††††††††††††††††††††††††††††††††††B
†††††††††††††††††††††††††††††††††††††††††††††††††††䈠Ȁ
1㐱㔹㠠†††††††††††††††††††††††††††††††††††††††††††††††††††䈀Ȁ
Arial1
Arial1
Arial1
Arial1
"$"#,##0_);\("$"#,##0\)
"$"#,##0_);[Red]\("$"#,##0\)
"$"#,##0.00_);\("$"#,##0.00\)
"$"#,##0.00_);[Red]\("$"#,##0.00\)
_("$"* #,##0_);_("$"* \(#,##0\);_("$"* "-"_);_(@_)
_(* #,##0_);_(* \(#,##0\);_(* "-"_);_(@_)
_("$"* #,##0.00_);_("$"* \(#,##0.00\);_("$"* "-"??_);_(@_)
_(* #,##0.00_);_(* \(#,##0.00\);_(* "-"??_);_(@_)à
Sheet1
Sheet2
Sheet3
RECIEPT NUMBER
EMAIL ID
PASSPORT NUMBER
APPOINTMENT DATE ( mm-dd-yyyy)
while my desired output is
RECIEPT NUMBER
EMAIL ID
PASSPORT NUMBER
APPOINTMENT DATE ( mm-dd-yyyy)
in a table..........
regards
vivek.s
-
Jan 24th, 2005, 11:54 PM
#9
Thread Starter
Fanatic Member
Re: copying data from excel to word
anyways to do this?
thanks and regards
vivek.s
-
Jan 24th, 2005, 11:56 PM
#10
Re: copying data from excel to word
post it, and we'll take a look. you may have to copy/paste it into word.
-
Jan 25th, 2005, 12:06 AM
#11
Thread Starter
Fanatic Member
Re: copying data from excel to word
hi
i have to do it using my VB program and data in excel shud be pated in a table in word.......
regards
vivek.s
-
Jan 25th, 2005, 12:08 AM
#12
Re: copying data from excel to word
just open excel, copy the cells, open word and paste them.
-
Jan 25th, 2005, 01:10 AM
#13
Re: copying data from excel to word
Sup vivek. You can insert an Excel workbook into a Word document like
below. Change the parameters if you want a linked object, etc.
VB Code:
'Word application
Application.Selection.InlineShapes.AddOLEObject ClassType:="Excel.Sheet.8", FileName:= _
"D:\Book1.xls", LinkToFile:=False, DisplayAsIcon:=False
Not sure if this is how you need it but I thought I would post it and find out.
HTH
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 25th, 2005, 01:58 AM
#14
Fanatic Member
Re: copying data from excel to word
I started working on it once i realized noone else wants to takle this, ( !!!NO OFFENCE!!!) and i got it to work sucessfully!!! just make a XLS called "Book1.xls" in drive C or just edit the code, and in the XLS put some data where ever, and then run this and it will make a file called "2.doc" on the C:\ and then open it and !Vwala!
VB Code:
Dim objExcel As Object
Dim objWord As Object
Set objExcel = CreateObject("excel.application")
Set objWord = CreateObject("word.application")
objWord.documents.Add
objExcel.workbooks.open ("C:\book1.xls")
objExcel.cells.Select
objExcel.cells.Copy
objWord.selection.Paste
objWord.activedocument.saveas "C:\2.doc"
Clipboard.Clear
objExcel.quit
objWord.quit
Set objWord = Nothing
Set objExcel = Nothing
PS: FYI, it is really slow!
Last edited by ALL; Jan 25th, 2005 at 02:15 AM.
-
Jan 25th, 2005, 03:07 AM
#15
Re: copying data from excel to word
didn't you see RD's code? did you try it? (I didn't)
-
Jan 25th, 2005, 09:52 AM
#16
Thread Starter
Fanatic Member
-
Jan 25th, 2005, 10:46 AM
#17
New Member
Re: copying data from excel to word
I tried the code.........its working well for the first sheet.........but how can i copy the contents from second sheet or 3rd sheet?
Regards
karthik
-
Jan 25th, 2005, 11:41 AM
#18
Re: copying data from excel to word
 Originally Posted by Karslive
I tried the code.........its working well for the first sheet.........but how can i copy the contents from second sheet or 3rd sheet?
Regards
karthik
Which posted code are you refering to?
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 25th, 2005, 11:48 AM
#19
New Member
Re: copying data from excel to word
i used the code given by All.......and modified to work for different sheets...i used this code
Set bk = objExcel.Workbooks.Open("C:\Book1.xls")
Set sh = bk.Worksheets("Sheet3")
sh.UsedRange.Copy
Now i am facing a problem.......on how to insert a string into word using VB.......
regards
karthi
-
Jan 25th, 2005, 12:41 PM
#20
Re: copying data from excel to word
If your using Alls code then the next line would be this - objWord.selection.Paste,
but you need his code to create the Word doc first.
HTH
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jan 25th, 2005, 02:00 PM
#21
Fanatic Member
Re: copying data from excel to word
i was going to add a thing so you could select what sheet to get data out of, but i figured i would keep it simple, it seems to work better usually
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|