Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-28-2015, 03:34 AM
macropod's Avatar
macropod macropod is offline Extract Data From Text file based on Pattern Windows 7 64bit Extract Data From Text file based on Pattern Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,385
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

You could try changing:
.Cell(i, 3).Range.Text = StrTxt
to:


.Cell(i, 3).Range.InsertBefore StrTxt & vbcr
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #2  
Old 10-30-2015, 11:31 PM
PRA007's Avatar
PRA007 PRA007 is offline Extract Data From Text file based on Pattern Windows 7 32bit Extract Data From Text file based on Pattern Office 2010 32bit
Competent Performer
Extract Data From Text file based on Pattern
 
Join Date: Dec 2014
Location: Ahmedabad, Gujrat, India
Posts: 145
PRA007 is on a distinguished road
Default

After trial and error I could find why my error '91' is still there.

Coincidently document I provided contains all the occurrences of word find in the corresponding database files.

In my day to day word there may be some US numbers that may not be present in excel document.

In those cases I want to go ahead without adding anything.

Is there any way to skip if the search not foud
Reply With Quote
  #3  
Old 10-30-2015, 11:49 PM
macropod's Avatar
macropod macropod is offline Extract Data From Text file based on Pattern Windows 7 64bit Extract Data From Text file based on Pattern Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,385
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
After trial and error I could find why my error '91' is still there.
Unless you can provide details of when the error occurs (e.g. what is the first row in the Word document that doesn't get updated & does the column 2 value exist in the workbook), there's not much I can do about that.
Quote:
Originally Posted by PRA007 View Post
Is there any way to skip if the search not foud
That's what the code already does.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #4  
Old 10-31-2015, 02:01 AM
PRA007's Avatar
PRA007 PRA007 is offline Extract Data From Text file based on Pattern Windows 7 32bit Extract Data From Text file based on Pattern Office 2010 32bit
Competent Performer
Extract Data From Text file based on Pattern
 
Join Date: Dec 2014
Location: Ahmedabad, Gujrat, India
Posts: 145
PRA007 is on a distinguished road
Default

It worked perfect for first sample files I provided.

Please forgive me for providing new sample files as it seems the only solution for now.

In my current sample file there are all the elements (or say possible problems).

For my current file till raw 4 your code works fine after that when it comes to raw 5 it shows error. I thought error is because US RE44048 is not present in the database 1 file.

I don't know what the problem is but it shows
I got temporary solution.

I recorded macro to remove US [0-9]{5} and US [0-9]{8,11} in a temporary
It works fine for now. I Replaced column 3 then with original document.
Code:
Run-time Error '91':
Object Variable or with block variable not set.
I tried to add RE44048 in database1 file (last raw) still problem persist. It stopped without showing any error.

I don't have any clue whats going on now.

Please find my files at:
https://sites.google.com/site/rtsk2015/fo
Download: Main.docx
Download: Database1.xlsx

Last edited by PRA007; 10-31-2015 at 04:40 AM.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Extract Data From Text file based on Pattern How to Extract Data from table based on pattern. PRA007 Word Tables 4 03-17-2015 11:05 PM
Retrieving data from data base based on text selection capitala PowerPoint 0 12-10-2014 08:10 AM
Extract Data From Text file based on Pattern Inserting text from one word file into another based on an excel input jmaxcy Excel 14 11-01-2013 04:07 PM
Inserting text from one word file into another based on an excel input jmaxcy Word 3 11-01-2013 01:26 AM
Is there a way to do this? (automatically enter text based on form data) TIKKI555 Word 0 05-26-2010 09:21 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:13 PM.


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