Solved

Word - Access

Posted on 2016-10-14
6
62 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
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 a watermark for their document, customizing it, and saving it for viewing/printing needs.
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.

825 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