Solved

Word - Access

Posted on 2016-10-14
6
55 Views
Last Modified: 2016-10-26
I already Posted this question, but maybe i had some typo errors, so i revised it a little.

I have a .dat file when i open it with M/S Word, Notepad or WordPad the whole document is on one line because there is no line break only a Tilde "~" at the end of the line.
I would like to do a edit/replace with a carriage return.
 
Also is there a utility to convert the tilde to a carriage return?
I want to open it in ms Acc2010 thru code and process line by line.
Thanks in advance
0
Comment
Question by:frimy
  • 3
  • 2
6 Comments
 
LVL 49

Accepted Solution

by:
Rgonzo1971 earned 250 total points
ID: 41844719
HI,

Yu could use word to replace the tilde

Home / Editing / Replace

Find What: ~
 
Replace With: ^p

Regards
0
 
LVL 16

Assisted Solution

by:theo kouwenhoven
theo kouwenhoven earned 250 total points
ID: 41844744
Use notepad++ and replace ~ with \r\n
0
 

Author Closing Comment

by:frimy
ID: 41845818
it works fine but I want to do programmatically
with vba
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 16

Expert Comment

by:theo kouwenhoven
ID: 41846529
With VBA would be something like:

Sub FindAndReplaceAll()
  Dim myRange As Range
  For Each myRange In ActiveDocument.StoryRanges
    With myRange.Find
      .Text = "~"
      .Replacement.Text = Chr(13) + Chr(10)
      .Wrap = wdFindContinue
      .Execute Replace:=wdReplaceAll
    End With
  Next myRange
End Sub


Chr(13)  + Chr(10) is CrLf, but you also can use the Chr(13) only.
0
 

Author Comment

by:frimy
ID: 41853007
Thanks
I was out of my office a few days.
I'm using Access code 2010. (it doesn't like the range type)
Can you give me an example?
Also, can I just pass to the function a FileName and replace or we have to create a new output file?
Thanks again
0
 

Author Comment

by:frimy
ID: 41860965
I already found a solution using the Replace function.
Thank you all
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
Introduction This tutorial provides instructions on how to properly format your Word document using the inbuilt tools provided. The benefits of using these tools means your documents are more accessible and easily portable to other applications an…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now