Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-25-2015, 04:19 PM
macropod's Avatar
macropod macropod is offline Extracting data from excel document using word Windows 7 64bit Extracting data from excel document using word Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by PRA007 View Post
Problems
1. I want to skip If .Find.Found Then fails.



Means it adds data every where irrespective of found or not.
If nothing is found, there is nothing to process and, hence, nothing to add.
Quote:
Originally Posted by PRA007 View Post
2. I could not figure out how to search from paragraph 1 to 5 as current code searches only in paragraph 1. I want to start search string from paragraph 1.
What if there is less than 5 paragraphs or more than 5 paragraphs?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 11-25-2015, 08:55 PM
PRA007's Avatar
PRA007 PRA007 is offline Extracting data from excel document using word Windows 7 32bit Extracting data from excel document using word Office 2010 32bit
Competent Performer
Extracting data from excel document using word
 
Join Date: Dec 2014
Location: Ahmedabad, Gujrat, India
Posts: 145
PRA007 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
If nothing is found, there is nothing to process and, hence, nothing to add.
As I told, I don't have much knowledge right not regarding vba. I don't know from the code where to skip adding data.

For example

Code:
With .Cell(i, 4).Range
          If Len(.Text) > 2 Then
            .InsertBefore "Er.Prio: " & StrTxt3 & vbCr
          Else
            .InsertBefore "Er.Prio: " & StrTxt3
          End If
from above code it is adding Er.Prio: everywhere irrespective of column 2 search find.

Quote:
Originally Posted by macropod View Post
What if there is less than 5 paragraphs or more than 5 paragraphs?
As I told, I don't have much knowledge right not regarding vba. I Just want to start My search from .Cell(i, 2).Range.Paragraphs(1) but not limited to paragraph(1). There are more/less than one paragraph sometimes in the document.

I don't know how to make this things happen.
My search string is

Code:
WO [0-9]{5,} [A-Z0-9]{1,2}^13*13[A-VX-Z][A-Z]
Please note that this string has nothing to do with current code but have much usefulness on overall process. please see

Quote:
2. If column 2 first paragraph contains WO number like WO 2015171641 A1, and if there is no paragraph 3.
for example

column 2 cell
WO 2015171641 A1¶
Some text¤

I want to search WO number and add in main.docx following data from database.xlsx.

column 3 = add text "International Publication"
column 4 = Column E from Database.
column 5 = column B from database &vbCr & column C from database
Reply With Quote
  #3  
Old 11-26-2015, 02:43 AM
PRA007's Avatar
PRA007 PRA007 is offline Extracting data from excel document using word Windows 7 64bit Extracting data from excel document using word Office 2010 32bit
Competent Performer
Extracting data from excel document using word
 
Join Date: Dec 2014
Location: Ahmedabad, Gujrat, India
Posts: 145
PRA007 is on a distinguished road
Default

The Problem Looks like
Code:
If .Find.Found Then
and

Code:
With .Cell(i, 5).Range
are not linked. I may be wrong.
Reply With Quote
Reply

Tags
excel vba, word vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting data from excel document using word Extracting Data from Word Documents Atomizer Word VBA 3 08-24-2015 04:49 PM
Extracting data from excel document using word extracting data from word docs stubevh Word 2 03-04-2015 06:27 PM
Extracting data from excel document using word Extracting data from excel Eric855 Word 6 07-25-2013 08:02 AM
Extracting data from excel document using word Extracting text from a Word Doc into Excel dgcarlin Word VBA 1 07-06-2012 05:46 PM
Extracting Contacts Data from Excel Caesar Outlook 1 05-08-2011 05:54 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:26 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft