+ Reply to Thread
Results 1 to 10 of 10

Need to create a Excel Macro to import text from Word to Excel

  1. #1
    Forum Contributor
    Join Date
    11-29-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    101

    Need to create a Excel Macro to import text from Word to Excel

    Hi Everyone,

    I need your help in creating a macro that should copy a text from word document and paste that into excel document.

    I'm attaching a word and excel document. If you see the word document, there will be a table. If the content of the second column is "Casual Visit" then it should take its corresponding value (i.e $15) and paste that into the excel document (in the cell I2). Is it possible to handle this. Please help me as i'm very new to macro. Thanks in advacne
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    11-29-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    101

    Re: Need to create a Excel Macro to import text from Word to Excel

    Can someone please help me?

  3. #3
    Forum Contributor
    Join Date
    11-29-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    101

    Re: Need to create a Excel Macro to import text from Word to Excel

    I got this code from internet.

    Please Login or Register  to view this content.
    I'm getting an error "Run-time error 91 : object variable or with block variable not set" on the line "Set rng = wdApp.ActiveDocument.Content"
    Please help me in overcoming the error i'm facing. Also i want to know if that code is a right approach for my requirement . Please help me as this is very important to me.

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Need to create a Excel Macro to import text from Word to Excel

    attach your doc file for testing
    If solved remember to mark Thread as solved

  5. #5
    Forum Contributor
    Join Date
    11-29-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    101

    Re: Need to create a Excel Macro to import text from Word to Excel

    Quote Originally Posted by patel45 View Post
    attach your doc file for testing
    Hi thanks for replying. I'm attaching the files here.
    Attached Files Attached Files

  6. #6
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Need to create a Excel Macro to import text from Word to Excel

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    11-29-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    101

    Re: Need to create a Excel Macro to import text from Word to Excel

    Quote Originally Posted by patel45 View Post
    Please Login or Register  to view this content.
    Hi.. this works fine.

    TheContent = rng.Cells(1).Next.Range.Text

    The above line searches for particular word(TextToFind) and assigning the next row's content into "The Content" variable. Can you please tell me what to do in case i want to assign the next word of the "TextToFind".

    For example consider i'm having some line as Casual Visit $5000

    In this case i'm searching for "Casual visit" and once i find the casual visit i should assign $5000 to "The Content" variable.

  8. #8
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Need to create a Excel Macro to import text from Word to Excel

    You have "Casual Visit $5000" in a cell of the table or in a line ?

  9. #9
    Forum Contributor
    Join Date
    11-29-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    101

    Re: Need to create a Excel Macro to import text from Word to Excel

    Quote Originally Posted by patel45 View Post
    You have "Casual Visit $5000" in a cell of the table or in a line ?
    Hi,

    It's in a cell of table.
    Last edited by sugaprasad; 01-22-2013 at 03:30 AM.

  10. #10
    Forum Contributor
    Join Date
    11-29-2012
    Location
    Coimbatore, India
    MS-Off Ver
    Excel 2010
    Posts
    101

    Re: Need to create a Excel Macro to import text from Word to Excel

    Quote Originally Posted by patel45 View Post
    You have "Casual Visit $5000" in a cell of the table or in a line ?
    Its within a cell. I'm attaching a word document. Attachment name (Highlighted with fields_updated.doc)

    There are two Columns. "ABC" & "Managing"

    I have highlighed the things in yellow color which i want to capture.


    Please help me in capturing them.
    Attached Files Attached Files
    Last edited by sugaprasad; 01-22-2013 at 03:36 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

X vBulletin 4.1.8 Debug Information

  • Page Generation 0.06869 seconds
  • Memory Usage 9,089KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (3)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (10)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (4)navbar_noticebit
  • (6)option
  • (5)postbit_attachment
  • (10)postbit_legacy
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (4)showthread_bookmarksite
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper
  • (1)vbseo_linkbackmenu_entry 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (39):
  • ./vbseo.php
  • ./env.php
  • ./vbseo/includes/functions_vbseo.php
  • ./vbseo/includes/functions_vbseo_pre.php
  • ./vbseo/includes/functions_vbseo_url.php
  • ./vbseo/includes/functions_vbseo_createurl.php
  • ./vbseo/includes/functions_vbseo_db.php
  • ./vbseo/includes/functions_vbseo_vb.php
  • ./vbseo/includes/functions_vbseo_seo.php
  • ./vbseo/includes/functions_vbseo_misc.php
  • ./vbseo/includes/functions_vbseo_crr.php
  • ./vbseo/includes/functions_vbseo_cache.php
  • ./vbseo/includes/functions_vbseo_hook.php
  • ./vbseo/includes/functions_vbseo_startup.php
  • ./includes/config.php
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/functions.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/functions_cforum.php
  • ./includes/functions_facebook.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php
  • ./includes/functions_notice.php 

Hooks Called (48):
  • init_startup
  • friendlyurl_resolve_class
  • database_pre_fetch_array
  • database_post_fetch_array
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • fetch_musername
  • cache_templates
  • template_register_var
  • parse_templates
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • reputation_image
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit
  • tag_fetchbit_complete
  • forumrules
  • showthread_bookmarkbit
  • navbits
  • navbits_complete
  • showthread_complete


Search Engine Friendly URLs by vBSEO 3.6.0 RC 1