Reply
 
Thread Tools Display Modes
  #1   Report Post  
andywsw andywsw is offline
Junior Member
 
Posts: 0
Exclamation Exporting data from MS Excel to MS Word VBA

Hi guys i need advice on VBA ( ms word )

Let me explain what i am trying to do is that , firstly i have done a userform in MS words. In one of my frame there is this label, when the user clicks on it , it will put data from textbox1 to Excel workbook named "book1.xlsx" and split the words by " ; " . This is done because the text box has multple value in a string which paste into a cell of excel which then split into words to row of cells in column A . Resulting like a normal table with datas in excel.


right now what i need help is that i would like to copy down to the last row of data ( column A to G ) and paste the rage of data into my words by DataType:=wdPasteOLEObject on to a book mark call "excel table"



This is my code i have writen so far
Private Sub Label17_Click()
Application.ScreenUpdating = False
Set objexcel = CreateObject("excel.Application")
Set wb = objexcel.Workbooks.Open("C:\Desktop\book1.xlsx")


wb.Worksheets("Sheet1").Range("A2") = TextBox1.Value


Dim sText As String, arText

sText = wb.Worksheets("Sheet1").Range("A2").Value

arText = Split(sText, ";")

wb.Worksheets("Sheet1").Range("A2:A100" & CStr(16 + UBound(arText))).Value = wb.Worksheets("Sheet1").WorksheetFunction.Transpos e(arText)

Application.ScreenUpdating = True
end sub


Thanks in advance ! cheers

Last edited by andywsw : May 8th 12 at 04:49 AM
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting Word document into excel automatically without opening excel rahul4real[_3_] Microsoft Word Help 1 June 8th 09 10:04 AM
Exporting Data into WORD Table RedHeadedMonster Tables 1 November 13th 08 12:58 AM
exporting data from reviewing pane in Word Mary. Microsoft Word Help 2 September 12th 07 12:14 AM
Exporting Word Form Data into Excel Dazed&Confused Microsoft Word Help 2 March 24th 06 07:57 AM


All times are GMT +1. The time now is 12:30 AM.

Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"