Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Word - Access

Posted on 2016-10-14
6
Medium Priority
?
97 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 53

Accepted Solution

by:
Rgonzo1971 earned 1000 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 1000 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
[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

 
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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Lost Word File? Eagerly, need it back? Read ahead; this File Recovery guide is for you.
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 shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:

876 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