Results 1 to 2 of 2

Thread: Excel to Word using VBA in word

Hybrid View

  1. #1
    Member
    Join Date
    Nov 11
    Posts
    39

    Excel to Word using VBA in word

    I need to get data from cell A1 from an excel file to a word file from which i'll be using a macro.

    Suppose if i'm using a form ( in Word ) with a text box & a command button..I need the entries of A1 to be displayed in the text box

  2. #2
    PowerPoster
    Join Date
    Dec 04
    Posts
    18,524

    Re: Excel to Word using VBA in word

    see the tutorial, in the FAQ thread at the top of this forum, on automation of office applications

    as you give little information, it is hard to help
    if workbook is already open, you can try like
    vb Code:
    1. textbox1 = getobject(fullpath\workbookname).sheets("sheet1").range("a1")

    if it is not already open, you would need to create an object instance of excel, open the workbook, read the range value, close workbook and quit excel
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •