Solved

Word - Access

Posted on 2016-10-14
6
43 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 48

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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

A few years ago I was very much a beginner at VBA, and that very much remains the case today.  I'll do my best to explain things as I go in the hope that other beginners can follow.  If you just want to check out a tool that creates a Select Case fu…
Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
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…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

708 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

13 Experts available now in Live!

Get 1:1 Help Now