473,396 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Working with files in VB 6.0

49
I've a RTF file which is like a report having some text and some variable names same as the table field name. I want my program to read the RTF file character by character, then whenever it encounters a field name , it should replace it with the table field value. And whenever it encounters a space or any tag or any special character , it should write that only i.e. the format should remain the same as before only the values to be substituted in place of field names. Can you provide me the code , i need it urgently. Thanking You
Jan 9 '07 #1
48 5912
You can try to use ReadLine method and to store the result in a buffer (or string),
Here you find how to use ReadLine method:
'---------------------------------------------------------------------------------------
Dim f, fs
Dim buff As String
Dim ForReading
ForReading = 1
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("c:\Documents and Settings\my folder\testfile.txt",ForReading, TristateFalse)

buff = f.Readline

f.Close
MsgBox buff ' view buffer string
'---------------------------------------------------------------------------------------
Of course this is not the complete code for your problem but it gives you a starting point.
Note:
I think it's not possible read and write the same file at once you need to use an output file



I've a RTF file which is like a report having some text and some variable names same as the table field name. I want my program to read the RTF file character by character, then whenever it encounters a field name , it should replace it with the table field value. And whenever it encounters a space or any tag or any special character , it should write that only i.e. the format should remain the same as before only the values to be substituted in place of field names. Can you provide me the code , i need it urgently. Thanking You
Jan 9 '07 #2
Killer42
8,435 Expert 8TB
I've a RTF file which is like a report having some text and some variable names same as the table field name. I want my program to read the RTF file character by character, then whenever it encounters a field name , it should replace it with the table field value. And whenever it encounters a space or any tag or any special character , it should write that only i.e. the format should remain the same as before only the values to be substituted in place of field names. Can you provide me the code , i need it urgently. Thanking You
It might simplify things if you place a RichTextBox control on your form (add it to your project first, under Project | Components). Once you read the file into this control, you can deal with the text, the formatting or both. And hopefully, you won't have to interpret all the tags.
Jan 9 '07 #3
amitp
49
hi,
i've used the following code. but i don't know how to read the contents of the file into a string. According to you i can't read and write the same file at once, so how can i do that. how can i read the file contents into buffer and then write it to an output file to make the same format. Could you help me out. Thanking You.

Dim oWordDoc As Word.Document
Dim AppWord As New Word.Application
Dim f, fs As Object
Dim buffer As String
Dim FileName As String
FileName = "C:\KPN\Q0000001.RTF"
Set oWordDoc = AppWord.Documents.Open(FileName)
Jan 11 '07 #4
Here you find some code to open a .rtf , find one string then replace with another string everywhere in the file, finally save changes to an output file.

Try to adapt this code to make your own function , (it needs an empty Filename.rtf in c:\ )

'-------------------------------------------------------------------------
Private Sub CommandButton1_Click()

Dim wrdApp As Word.Application
Dim FileName As String
Dim Sfind, Sreplace
FileName = "\Filename.rtf" ' an empty existing rtf file in c:\
Sfind = "ciao" ' string to find
Sreplace = "pippo" ' string to replace

Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open(FileName)

' put some text with string to replace ,
wrdDoc.Content.InsertAfter "ciao Here is a ciao example test line ciao #"


'find and replace string
wrdApp.Application.Selection.Find.ClearFormatting
wrdApp.Application.Selection.Find.Replacement.Clea rFormatting
With wrdApp.Selection.Find
.Text = Sfind
.Replacement.Text = Sreplace
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
wrdApp.Application.Selection.Find.Execute Replace:=wdReplaceAll

' Save to ouput file
With wrdDoc
.SaveAs ("\NewFilename.rtf")
.Close ' close the document
End With
wrdApp.Quit ' close the Word application

Set wrdDoc = Nothing
Set wrdApp = Nothing

End Sub

'--------------------------------------------------------------------------

Note you create a new file to store changes (NewFilename.rtf) .
I would pass to the function as parameters: FileName , Sfind and Sreplace
I hope it's what you're lookin for...

ciao


hi,
i've used the following code. but i don't know how to read the contents of the file into a string. According to you i can't read and write the same file at once, so how can i do that. how can i read the file contents into buffer and then write it to an output file to make the same format. Could you help me out. Thanking You.

Dim oWordDoc As Word.Document
Dim AppWord As New Word.Application
Dim f, fs As Object
Dim buffer As String
Dim FileName As String
FileName = "C:\KPN\Q0000001.RTF"
Set oWordDoc = AppWord.Documents.Open(FileName)
Jan 12 '07 #5
amitp
49
Thank you very much for the code. But this code doesn't replace the string. I don't know what it is doing but it is increasing the file size. i want to open a template RTF file and search for a particular string and then replace it with an another string and save the file with another name with same format. I'll give the RTF file. Below one is template RTF file from which i hav to search for a string.
There r fileld like "<<s_naam>>" present in the file and i need to replace it with another string or value. Rest all should remain same. Needing help in this.



{\rtf1\ansi \deff4\deflang1033{\fonttbl{\f4\froman\fcharset0\f prq2 Times New Roman;}{\f5\fswiss\fcharset0\fprq2 Arial;}{\f70\fswiss\fcharset0\fprq2 KPN Sans{\*\falt Arial};}}{\colortbl;\red0\green0\blue0;\red0\green 0\blue255;
\red0\green255\blue255;\red0\green255\blue0;\red25 5\green0\blue255;\red255\green0\blue0;\red255\gree n255\blue0;\red255\green255\blue255;\red0\green0\b lue128;\red0\green128\blue128;\red0\green128\blue0 ;\red128\green0\blue128;\red128\green0\blue0;
\red128\green128\blue0;\red128\green128\blue128;\r ed192\green192\blue192;}{\stylesheet{\nowidctlpar \f4\fs20\lang2057 \snext0 Normal;}{\s1\sb240\sa60\keepn\nowidctlpar \b\f5\fs28\lang2057\kerning28 \sbasedon0\snext0 heading 1;}{
\s2\sb240\sa60\keepn\nowidctlpar \b\i\f5\lang2057 \sbasedon0\snext0 heading 2;}{\*\cs10 \additive Default Paragraph Font;}{\s15\nowidctlpar\tqc\tx4536\tqr\tx9072 \f4\fs20\lang2057 \sbasedon0\snext15 header;}{\*\cs16 \additive\f5\fs16 \sbasedon10
CellTitel;}{\*\cs17 \additive\fs22 \sbasedon16 CellTitelGroot;}{\s18\nowidctlpar\tqc\tx4536\tqr\t x9072 \f4\fs20\lang2057 \sbasedon0\snext18 footer;}{\s19\sb120\sa120\nowidctlpar \b\f4\fs20\lang2057 \sbasedon0\snext0 caption;}}{\info{\title Klantgegevens}
{\author T-Werkplek}{\operator T-Werkplek}{\creatim\yr1998\mo6\dy10\hr14\min36}{\re vtim\yr2002\mo9\dy19\hr11\min22}{\printim\yr1997\m o3\dy11\hr14\min10}{\version2}{\edmins0}{\nofpages 1}{\nofwords126}{\nofchars720}{\*\company PTT Telecom I&AT}{\vern57395}}
\paperw11907\paperh16840\margl510\margr510\margt43 1\margb431 \widowctrl\ftnbj\aenddoc\hyphhotz425\hyphcaps0\for mshade \fet0\sectd \psz9\linex0\headery284\footery369\colsx709\endnhe re {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\ pntxta .}}
{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{ \pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnha ng{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}
{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{ \pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhan g{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnha ng{\pntxtb (}{\pntxta )}}{\*\pnseclvl9
\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\trowd \trgaph56\trleft-56 \clbrdrt\brdrs\brdrw15 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx6036\clbrdrt\brdrs\brdrw15 \cellx6283\clbrdrt\brdrs\brdrw15 \clbrdrb
\brdrs\brdrw15 \cellx11143 \pard\plain \keepn\widctlpar\intbl \f4\fs20\lang2057 {\cs16\b\f70\fs16\lang19 Klantgegevens\cell }{\cs16\f70\fs14\lang19 Naam en voorletters of bedrijfsnaam contractant
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_naam>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Naam en voorletters of bedrijfsnaam gebruiker
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_naam_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\b\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \clbrdrb
\brdrs\brdrw15 \cellx6036\cellx6283\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19 Adres}{\cs16\i\f70\fs14\lang19
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_adres>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Aansluitadres
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_aansluitadres>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19
Postcode en woonplaats
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_pc_wpl>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Postcode en woonplaats
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_pc_wpl_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \clbrdrb
\brdrs\brdrw15 \cellx6036\cellx6283\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx8484\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19 Land
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_land_zip>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Land
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_land_zip_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15
\clbrdrb\brdrs\brdrw15 \cellx3925\cellx6036\cellx6283\clbrdrt\brdrs\brdrw 15 \clbrdrb\brdrs\brdrw15 \cellx8484\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19
Contactpersoon
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_cp>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell Telefoonnummer
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_tel>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Contactpersoon
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_cp_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell Telefoonnummer
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_tel_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \cellx6036
\cellx6283\clbrdrt\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19 Inschr.nr. KVK
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_nr_kvk>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Nieuw adres bij verhuizing
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_adres_verh>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\pard \nowidctlpar
\par }
Jan 15 '07 #6
Killer42
8,435 Expert 8TB
It might be simpler if you forget that it's an RTF file and just treat it as one big chunk of text. Read it into a string, do the scan and replace, then write it out to another file. As long as the output file has the extension .RTF, it should work OK.

Here's some code just off the top of my head...
Expand|Select|Wrap|Line Numbers
  1. Dim s As String, L As Long
  2. Open "InputFile.Rtf" For binary access read shared as #1
  3. L = Lof(1)
  4. s = Space$(L)
  5. Get #1,,s
  6. Close #1
  7.  
  8. ' Do the scan and replace at this point.
  9. ' I'm sure VB code to search and replace within a string
  10. ' has been covered plenty of times on TheScripts - try a search.
  11.  
  12. Open "OutputFile.Rtf" For Binary access write lock write As #1
  13. put #1,,s
  14. Close #1
  15.  
Jan 15 '07 #7
Yes that's easier but what about the format?

I think font stuff (size, font type...) and so on will change if you treat it as text file.
Ehy Killah , did you try to run your code with a particular format (bold, underline and so on)? Is it workin?

However , the code I provided WORKS, but you had to adapt it. I could make a nice Sub which was givin proper results WITHOUT changing the format.I have it at home I will post it at about 18.30.
Bye!




It might be simpler if you forget that it's an RTF file and just treat it as one big chunk of text. Read it into a string, do the scan and replace, then write it out to another file. As long as the output file has the extension .RTF, it should work OK.

Here's some code just off the top of my head...
Expand|Select|Wrap|Line Numbers
  1. Dim s As String, L As Long
  2. Open "InputFile.Rtf" For binary access read shared as #1
  3. L = Lof(1)
  4. s = Space$(L)
  5. Get #1,,s
  6. Close #1
  7.  
  8. ' Do the scan and replace at this point.
  9. ' I'm sure VB code to search and replace within a string
  10. ' has been covered plenty of times on TheScripts - try a search.
  11.  
  12. Open "OutputFile.Rtf" For Binary access write lock write As #1
  13. put #1,,s
  14. Close #1
  15.  
Jan 15 '07 #8
Ok , maybe 18.30 is too late..This is the Sub I mentioned, below you will find an example showing how to use it. Of course Sfind must be present in the Inputfile and of course you can improve it!
I tried and it WORKS ...format is left unhaltered where Sfind is replaced !!!

Tot ziens amitp !
'-----------------------------------------------------------------------------------------------------------
Sub FindReplace(ByVal Sfind As String, ByVal Sreplace As String, ByVal Inputfile As String, ByVal Outputfile As String)

Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open(Inputfile)

wrdApp.Application.Selection.Find.ClearFormatting
wrdApp.Application.Selection.Find.Replacement.Clea rFormatting
With wrdApp.Selection.Find
.Text = Sfind
.Replacement.Text = Sreplace
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
wrdApp.Application.Selection.Find.Execute Replace:=wdReplaceAll

' Save to ouput file
With wrdDoc
.SaveAs (Outputfile)
.Close ' close the document
End With
wrdApp.Quit ' close the Word application

Set wrdDoc = Nothing
Set wrdApp = Nothing


End Sub
'---------------------------------------------------------------------------------------
' How to use it:

Private Sub CommandButton1_Click()

Dim wrdApp As Word.Application
Dim IFile, OFile As String
Dim Sfind, Sreplace
IFile = "\NEW\Input.rtf" ' an existing rtf file in c:\NEW\ where Sfind occurs
OFile = "\NEW\Output.rtf"
Sfind = "ciao" ' string to find
Sreplace = "pippo" ' string to replace

Call FindReplace(Sfind, Sreplace, IFile, OFile)

End Sub

'---------------------



Thank you very much for the code. But this code doesn't replace the string. I don't know what it is doing but it is increasing the file size. i want to open a template RTF file and search for a particular string and then replace it with an another string and save the file with another name with same format. I'll give the RTF file. Below one is template RTF file from which i hav to search for a string.
There r fileld like "<<s_naam>>" present in the file and i need to replace it with another string or value. Rest all should remain same. Needing help in this.



{\rtf1\ansi \deff4\deflang1033{\fonttbl{\f4\froman\fcharset0\f prq2 Times New Roman;}{\f5\fswiss\fcharset0\fprq2 Arial;}{\f70\fswiss\fcharset0\fprq2 KPN Sans{\*\falt Arial};}}{\colortbl;\red0\green0\blue0;\red0\green 0\blue255;
\red0\green255\blue255;\red0\green255\blue0;\red25 5\green0\blue255;\red255\green0\blue0;\red255\gree n255\blue0;\red255\green255\blue255;\red0\green0\b lue128;\red0\green128\blue128;\red0\green128\blue0 ;\red128\green0\blue128;\red128\green0\blue0;
\red128\green128\blue0;\red128\green128\blue128;\r ed192\green192\blue192;}{\stylesheet{\nowidctlpar \f4\fs20\lang2057 \snext0 Normal;}{\s1\sb240\sa60\keepn\nowidctlpar \b\f5\fs28\lang2057\kerning28 \sbasedon0\snext0 heading 1;}{
\s2\sb240\sa60\keepn\nowidctlpar \b\i\f5\lang2057 \sbasedon0\snext0 heading 2;}{\*\cs10 \additive Default Paragraph Font;}{\s15\nowidctlpar\tqc\tx4536\tqr\tx9072 \f4\fs20\lang2057 \sbasedon0\snext15 header;}{\*\cs16 \additive\f5\fs16 \sbasedon10
CellTitel;}{\*\cs17 \additive\fs22 \sbasedon16 CellTitelGroot;}{\s18\nowidctlpar\tqc\tx4536\tqr\t x9072 \f4\fs20\lang2057 \sbasedon0\snext18 footer;}{\s19\sb120\sa120\nowidctlpar \b\f4\fs20\lang2057 \sbasedon0\snext0 caption;}}{\info{\title Klantgegevens}
{\author T-Werkplek}{\operator T-Werkplek}{\creatim\yr1998\mo6\dy10\hr14\min36}{\re vtim\yr2002\mo9\dy19\hr11\min22}{\printim\yr1997\m o3\dy11\hr14\min10}{\version2}{\edmins0}{\nofpages 1}{\nofwords126}{\nofchars720}{\*\company PTT Telecom I&AT}{\vern57395}}
\paperw11907\paperh16840\margl510\margr510\margt43 1\margb431 \widowctrl\ftnbj\aenddoc\hyphhotz425\hyphcaps0\for mshade \fet0\sectd \psz9\linex0\headery284\footery369\colsx709\endnhe re {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\ pntxta .}}
{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{ \pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnha ng{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}
{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{ \pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhan g{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnha ng{\pntxtb (}{\pntxta )}}{\*\pnseclvl9
\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\trowd \trgaph56\trleft-56 \clbrdrt\brdrs\brdrw15 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx6036\clbrdrt\brdrs\brdrw15 \cellx6283\clbrdrt\brdrs\brdrw15 \clbrdrb
\brdrs\brdrw15 \cellx11143 \pard\plain \keepn\widctlpar\intbl \f4\fs20\lang2057 {\cs16\b\f70\fs16\lang19 Klantgegevens\cell }{\cs16\f70\fs14\lang19 Naam en voorletters of bedrijfsnaam contractant
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_naam>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Naam en voorletters of bedrijfsnaam gebruiker
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_naam_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\b\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \clbrdrb
\brdrs\brdrw15 \cellx6036\cellx6283\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19 Adres}{\cs16\i\f70\fs14\lang19
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_adres>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Aansluitadres
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_aansluitadres>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19
Postcode en woonplaats
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_pc_wpl>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Postcode en woonplaats
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_pc_wpl_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \clbrdrb
\brdrs\brdrw15 \cellx6036\cellx6283\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx8484\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19 Land
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_land_zip>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Land
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_land_zip_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15
\clbrdrb\brdrs\brdrw15 \cellx3925\cellx6036\cellx6283\clbrdrt\brdrs\brdrw 15 \clbrdrb\brdrs\brdrw15 \cellx8484\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19
Contactpersoon
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_cp>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell Telefoonnummer
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_tel>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Contactpersoon
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_cp_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell Telefoonnummer
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_tel_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \cellx6036
\cellx6283\clbrdrt\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19 Inschr.nr. KVK
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_nr_kvk>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Nieuw adres bij verhuizing
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_adres_verh>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\pard \nowidctlpar
\par }
Jan 15 '07 #9
Killer42
8,435 Expert 8TB
Yes that's easier but what about the format?
I think font stuff (size, font type...) and so on will change if you treat it as text file.
Ehy Killah , did you try to run your code with a particular format (bold, underline and so on)? Is it workin?
However , the code I provided WORKS, but you had to adapt it. I could make a nice Sub which was givin proper results WITHOUT changing the format.I have it at home I will post it at about 18.30.
I haven't tried that code at all - I just typed it straight into the message. If you have code which works, then that's great. :)

However, if the strings that are being replaced are in the actual text, then the formatting should not be an issue at all. I'm not an expert on RTF format, but consider HTML, or even the simple tags we use here on TheScripts. Let's say I have some text which includes tags to make things bold and underlined. I can do a search and replace on that text, and as long as it doesn't affect the tags, all should be well. Example (just typed in, to illustrate the point)...
  • Before replace:
    make things bold and underlined
  • After replace:
    make things buld and onderloned
Jan 15 '07 #10
Ok I admit I did underestimate this problem... I didnt get you ment you wanna replace FIELD CODEs (I dont know much about rtf).
So you should off/on field codes after/before replacing.
Then you can replace string; to do that I made another Sub (FieldCode_onoff).

Of course an approach as the Killah suggested can work, but someone says there's a 32k-filesize limit : vb-helper

My apologies ...the previous code is NOT replacing the FIELD CODE string but only text strings in rtf.
However the followin DOES WORK indeed! :-)

(tested with your file, I could replace "<<s_naam>>" with "pippo")

'--------------------------------FieldCode_onoff

Sub FieldCode_onoff(wrdDoc As Variant, onoff As Boolean)

wrdDoc.ActiveWindow.View.ShowFieldCodes = Not wrdDoc.ActiveWindow.View.ShowFieldCodes
wrdDoc.Application.DisplayStatusBar = True
wrdDoc.Application.ShowWindowsInTaskbar = True
wrdDoc.Application.ShowStartupDialog = True
With wrdDoc.ActiveWindow
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = True
.DisplayLeftScrollBar = False
.StyleAreaWidth = InchesToPoints(0)
.DisplayVerticalRuler = True
.DisplayRightRuler = False
.DisplayScreenTips = True
With wrdDoc.ActiveWindow.View
.ShowAnimation = True
.Draft = False
.WrapToWindow = False
.ShowPicturePlaceHolders = False
.ShowFieldCodes = onoff
.ShowBookmarks = False
.FieldShading = wdFieldShadingWhenSelected
.ShowTabs = False
.ShowSpaces = False
.ShowParagraphs = False
.ShowHyphens = False
.ShowHiddenText = False
.ShowAll = False
.ShowDrawings = True
.ShowObjectAnchors = False
.ShowTextBoundaries = False
.ShowHighlight = True
.DisplayPageBoundaries = True
.DisplaySmartTags = True
End With
End With
End Sub
'------------------------------------------------------------------------------

Now you have to call this Sub twice in Find_Replace, first you set FIELDCODEs visible (off), to do this after :

Set wrdDoc = wrdApp.Documents.Open(InputFile)


put :

Call FieldCode_onoff(wrdDoc, True)

Secondly , BEFORE the line:

With wrdDoc

put:

Call FieldCode_onoff(wrdDoc, False)

This will put FIELDCODEs non-visible (on again)
Note: output file increase of size cause the VBcode will be saved within the file.


To the Killah: I'm sure with your approach can be much easier ,but I wanted to learn how drive Word from VB.

Bye All !

Ok , maybe 18.30 is too late..This is the Sub I mentioned, below you will find an example showing how to use it. Of course Sfind must be present in the Inputfile and of course you can improve it!
I tried and it WORKS ...format is left unhaltered where Sfind is replaced !!!

Tot ziens amitp !
'-----------------------------------------------------------------------------------------------------------
Sub FindReplace(ByVal Sfind As String, ByVal Sreplace As String, ByVal Inputfile As String, ByVal Outputfile As String)

Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = True
Set wrdDoc = wrdApp.Documents.Open(Inputfile)

wrdApp.Application.Selection.Find.ClearFormatting
wrdApp.Application.Selection.Find.Replacement.Clea rFormatting
With wrdApp.Selection.Find
.Text = Sfind
.Replacement.Text = Sreplace
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
wrdApp.Application.Selection.Find.Execute Replace:=wdReplaceAll

' Save to ouput file
With wrdDoc
.SaveAs (Outputfile)
.Close ' close the document
End With
wrdApp.Quit ' close the Word application

Set wrdDoc = Nothing
Set wrdApp = Nothing


End Sub
'---------------------------------------------------------------------------------------
' How to use it:

Private Sub CommandButton1_Click()

Dim wrdApp As Word.Application
Dim IFile, OFile As String
Dim Sfind, Sreplace
IFile = "\NEW\Input.rtf" ' an existing rtf file in c:\NEW\ where Sfind occurs
OFile = "\NEW\Output.rtf"
Sfind = "ciao" ' string to find
Sreplace = "pippo" ' string to replace

Call FindReplace(Sfind, Sreplace, IFile, OFile)

End Sub

'---------------------
Jan 15 '07 #11
Killer42
8,435 Expert 8TB
Ok I admit I did underestimate this problem... I didnt get you ment you wanna replace FIELD CODEs (I dont know much about rtf).
No, I'm talking about replacing pieces of text within the string, and simply ignoring the tags/codes/whatever. The tags are simply more text. As long as you don't do anything to them, I expect they will continue to work OK. I could be wrong, of course - as I said, I'm not expert in RTF.

So you should off/on field codes after/before replacing.
Then you can replace string; to do that I made another Sub (FieldCode_onoff).
If you can avoid all this, I believe it will make your code much simpler.

Of course an approach as the Killah suggested can work, but someone says there's a 32k-filesize limit : vb-helper
Only if you're using the LEN= clause, and I can't imagine why you would. (Until now, I wasn't aware that you could use it with Binary). Reading a chunk of data from a binary file is only limited by the available memory. I have dealt with hundreds of MB at a time in some cases.
Jan 15 '07 #12
amitp
49
Thank you very much for your help. It's working perfectly fine.
Jan 16 '07 #13
Killer42
8,435 Expert 8TB
Thank you very much for your help. It's working perfectly fine.
I'm glad to hear that.

Just out of curiosity, what technique did you end up using? As I recall, there were a few ideas under discussion.
Jan 16 '07 #14
amitp
49
I've to append some MS Word 2003 documents to a single document. My word documents contain tables. Each document contains a single table. My code appended the files but there remains some spaces between the tables. Why these spaces comes. I want that the next word document should start at the EOF of immidiate above. I don't know much 'bout WORD 2003 . Could any one suggest me to handle the issue. I'm providing the code.

Dim wrdApp As Word.Application
Dim wrdDoc As New Word.Document
Dim file1, file2, file3, docName As String
file1 = "C:\Test.rtf"
file2 = "C:\Q0000001.rtf"
file3 = "C:\Q0000002.rtf"

Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = False
Set wrdDoc = wrdApp.Documents.Add(file1)
wrdDoc.Application.Selection.InsertFile (file2)
wrdDoc.Application.Selection.InsertBreak (WdBreakType.wdLineBreak)
wrdDoc.Application.Selection.InsertFile (file3)
wrdDoc.Application.Selection.InsertBreak (WdBreakType.wdLineBreak)
wrdDoc.SaveAs (file1)
wrdDoc.Close
Jan 18 '07 #15
Why Reading a word document in MS Word 2003 is slow as compared to reading MS Word 2000
Jan 23 '07 #16
amitp
49
I've to append some MS Word 2003 documents to a single document. My word documents contain tables. Each document contains a single table. My code appended the files but there remains some spaces between the tables. Why these spaces comes. I want that the next word document should start at the EOF of immidiate above. I don't know much 'bout WORD 2003 . Could any one suggest me to handle the issue. I'm providing the code.

Dim wrdApp As Word.Application
Dim wrdDoc As New Word.Document
Dim file1, file2, file3, docName As String
file1 = "C:\Test.rtf"
file2 = "C:\Q0000001.rtf"
file3 = "C:\Q0000002.rtf"

Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = False
Set wrdDoc = wrdApp.Documents.Add(file1)
wrdDoc.Application.Selection.InsertFile (file2)
wrdDoc.Application.Selection.InsertBreak (WdBreakType.wdLineBreak)
wrdDoc.Application.Selection.InsertFile (file3)
wrdDoc.Application.Selection.InsertBreak (WdBreakType.wdLineBreak)
wrdDoc.SaveAs (file1)
wrdDoc.Close
Jan 29 '07 #17
amitp
49
In addition to my previous query i've one more query. I want to read a Word document which contains some field values. How can i get the field values one by one by reading the document. Below is the content of my word document.
I want to use the word object. Waiting 4 ur reply.


<<klntgeg>> <<lynapinf>> <<apparatuur>> <<infra>> <<totaal>> <<btwdisc>> <<discove>> <<sinfra>> <<CNTKLANT>> <<gidsv>> <<install>> <<betaling>> <<ondertek>>
Jan 30 '07 #18
Goete Morgen....Amitp!

try to open your rtf as text file , if you do so a field code is identified by a keyword like MACROBUTTON (Note : length =11 ) etc, followed by the field name (like <<totaal>> )

If you create your rtf having field codes in c:\New\Input.rtf then you can try this vb code:
'---------------------------------------------------------------------------------------------------------------
Private Sub CommandButton2_Click()
Const ForReading = 1
Dim fs, f, count, cend, myLine ' string count/end,line buffer for file reading
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("\New\Input.rtf", ForReading, TristateFalse)
Dim Sfind 'string to find
Sfind = "<<"
Do
myLine = f.Readline
count = InStr(1, myLine, Sfind, 1)
While count <> 0
cend = InStr(count, myLine, ">>", 1) + 2
MsgBox Mid(myLine, count, cend - count)
count = InStr(count + Len(Sfind), myLine, Sfind, 1)
Wend
Loop Until Len(myLine) < 11 ' buffer too small ends the loop
End Sub

'-------------------------------------------------------------------------------------------

It will show all the field names in a Msg Box....Exit is when myLine length is < than 11 (less than MACROBUTTON).....Does it help?


Bye !





In addition to my previous query i've one more query. I want to read a Word document which contains some field values. How can i get the field values one by one by reading the document. Below is the content of my word document.
I want to use the word object. Waiting 4 ur reply.


<<klntgeg>> <<lynapinf>> <<apparatuur>> <<infra>> <<totaal>> <<btwdisc>> <<discove>> <<sinfra>> <<CNTKLANT>> <<gidsv>> <<install>> <<betaling>> <<ondertek>>
Feb 1 '07 #19
amitp
49
thanks for the ans. but could u help me in this query.

I've to append some MS Word 2003 documents to a single document. My word documents contain tables. Each document contains a single table. My code appended the files but there remains some spaces between the tables. Why these spaces comes. I want that the next word document should start at the EOF of immidiate above. I don't know much 'bout WORD 2003 . Could any one suggest me to handle the issue. I'm providing the code.

Dim wrdApp As Word.Application
Dim wrdDoc As New Word.Document
Dim file1, file2, file3, docName As String
file1 = "C:\Test.rtf"
file2 = "C:\Q0000001.rtf"
file3 = "C:\Q0000002.rtf"

Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = False
Set wrdDoc = wrdApp.Documents.Add(file1)
wrdDoc.Application.Selection.InsertFile (file2)
wrdDoc.Application.Selection.InsertFile (file3)
wrdDoc.SaveAs (file1)
wrdDoc.Close
Feb 1 '07 #20
As far as you terminate one table a newline char is added ,
that's why you have this problem...can be done but now I'm goin to have lunch!
Bye !

thanks for the ans. but could u help me in this query.

I've to append some MS Word 2003 documents to a single document. My word documents contain tables. Each document contains a single table. My code appended the files but there remains some spaces between the tables. Why these spaces comes. I want that the next word document should start at the EOF of immidiate above. I don't know much 'bout WORD 2003 . Could any one suggest me to handle the issue. I'm providing the code.

Dim wrdApp As Word.Application
Dim wrdDoc As New Word.Document
Dim file1, file2, file3, docName As String
file1 = "C:\Test.rtf"
file2 = "C:\Q0000001.rtf"
file3 = "C:\Q0000002.rtf"

Set wrdApp = CreateObject("Word.Application")
wrdApp.Visible = False
Set wrdDoc = wrdApp.Documents.Add(file1)
wrdDoc.Application.Selection.InsertFile (file2)
wrdDoc.Application.Selection.InsertFile (file3)
wrdDoc.SaveAs (file1)
wrdDoc.Close
Feb 1 '07 #21
amitp
49
Do u hav a solution for the one, then plz send it. Thanking You
Feb 2 '07 #22
...the easiest way would be to open your rtf file in Word , place the cursor at the right end of the table and pres Del ... the new line will be removed and the table will be merged with the second creating the whole table.

Of course if you have ...let's say a hundred tables to merge this is not really practical I know , in this case you need a specific prog which removes newlines.
Is this the case?

Do u hav a solution for the one, then plz send it. Thanking You
Feb 2 '07 #23
Killer42
8,435 Expert 8TB
...the easiest way would be to open your rtf file in Word , place the cursor at the right end of the table and pres Del ... the new line will be removed and the table will be merged with the second creating the whole table.

Of course if you have ...let's say a hundred tables to merge this is not really practical I know , in this case you need a specific prog which removes newlines.
Is this the case?
Surely you could do that in the code which is already being used to load them.
Feb 2 '07 #24
amitp
49
How can i read a doc file line by line there by calculating the total number of lines and identify the blank lines and then deleting the balnk lines from the file. can anybody having any code for this using VB 6.0
Feb 5 '07 #25
amitp
49
1> How can i read a doc file line by line there by calculating the total number of lines and identify the blank lines and then deleting the balnk lines from the file. can anybody having any code for this using VB 6.0

2> to replace the field values with text i've used the following code and that works fine for only for texts of max length of 255 characters and beyond that is gives an error Error- 5854 : String Parameter too long. Can any one hav the solution for this.

With wrdRepApp.Selection.find
.Text = sFind
.Replacement.Text = sReplace
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchKashida = False
.MatchDiacritics = False
.MatchAlefHamza = False
.MatchControl = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False

End With
Feb 5 '07 #26
Killer42
8,435 Expert 8TB
Expand|Select|Wrap|Line Numbers
  1. ...
  2. Set wrdDoc = wrdApp.Documents.Add(file1)
  3. wrdDoc.Application.Selection.InsertFile (file2)
  4. wrdDoc.Application.Selection.InsertBreak (WdBreakType.wdLineBreak)
  5. wrdDoc.Application.Selection.InsertFile (file3)
  6. wrdDoc.Application.Selection.InsertBreak (WdBreakType.wdLineBreak)
  7.  
You are asking how to avoid the blank lines between inserted documents. But surely your code (see highlighted lines above) is explicitly inserting a blank line after each file?
Feb 5 '07 #27
Killer42
8,435 Expert 8TB
2> to replace the field values with text i've used the following code and that works fine for only for texts of max length of 255 characters and beyond that is gives an error Error- 5854 : String Parameter too long. Can any one hav the solution for this.
One way to get around this sort of thing is to replace sections of the text. As a small example to illustrate the concept, let's say you want to convert the string "AAAAAAAA" to "ABCDABCD". You can do the same by converting all "AAAA" to "ABCD". You can also convert all "AAAA" to "@" then convert all "@" to "ABCD". Or convert all "AA" to "@", then convert all "@@" to "ABCD".

You can expand on this sort of technique - just use your imagination.
Feb 5 '07 #28
amitp
49
i deleted the highlighted lines but the spaces still remains. i happens with the case if the RTF file consists of only a table. That means when the files consisting of tables only appended explicitly a blank line is added. This is not the case with text. So kindly look into this.
Feb 6 '07 #29
Killer42
8,435 Expert 8TB
i deleted the highlighted lines but the spaces still remains. i happens with the case if the RTF file consists of only a table. That means when the files consisting of tables only appended explicitly a blank line is added. This is not the case with text. So kindly look into this.
Can you try playing around with commands like this between inserts?
Expand|Select|Wrap|Line Numbers
  1. wrdDoc.Application.Selection.TypeBackspace
  2.   and/or
  3. wrdDoc.Application.Selection.MoveLeft Unit:=wdCharacter, Count:=1
Feb 6 '07 #30
amitp
49
Thank u very much. Thats works perfectly fine.
Feb 6 '07 #31
Killer42
8,435 Expert 8TB
Thank u very much. Thats works perfectly fine.
I'm glad to hear that.

You really should try playing around with things in these situations, you'll learn heaps. All I did was create a simple test document in Word, with a table. Then I put the cursor at the end of the document, told Word to record a macro, then I moved the cursor back to where I wanted it. All I had to do then was copy the code from the macro it created for me. :D
Feb 6 '07 #32
amitp
49
Accoding to you i tried for the code that deletes an empty line but can i do this?
Can i read the whole document line by line , thereby copying the line content into a string recording the line number, then checking for the length of string. If it comes to zero(0), then that is a empty line and then delete the line. I tried the below code which moves the cursor up from the end of the file by one line until the first line or the top of the file comes. During the cursor movement it gives the line number.The problem is i'm not getting the condition to check for the empty line. plz look into this. Thanking You

Do Until (linecount = 1)
wrdDoc.Application.Selection.MoveUp Unit:=wdLine, Count:=1, Extend:=wdMove
linecount = wrdDoc.Application.Selection.Information(wdFirstCh aracterLineNumber)
wrdDoc.Application.Selection.Delete (This code deletes the line selected)
' End If
Loop
Feb 8 '07 #33
Killer42
8,435 Expert 8TB
Sorry amitp, I'm not ignoring you, just very busy.
Feb 8 '07 #34
amitp
49
It's Ok, but if u'll get time plz look into this. Thanking You
Feb 9 '07 #35
Killer42
8,435 Expert 8TB
Sorry amitp, I haven't had a chance to look into either of these problems. Plus, I'm not very experienced in working with Word documents from VB.

I've just split both questions off into separate threads, so that they are likely to get a response from others who may not have seen this old one.
Feb 22 '07 #36
amitp
49
I've some problem with WORD doc but i don't know the reason, need ur help.
U know that i'm replacing the field values(access datbse column names) in the DOC with the respective values(column values) from the Access databse. But when the text size exceeds a cell width , the text doesn't display i.e the text doesn't come(wrap) to a new line. But this is not the case when u type some text in the cell, i e. when u type some text in the cell and when the text length exceeds the cell width the text automatically wraps to new line. Why is the difference. I've mentioned the wraping text problem in a new thread and got the suggesstion to try WRODWRAP property of cell. But nothing happened. Could u tell me what can be done for this.
Mar 9 '07 #37
amitp
49
Now starting with the issue to find and replace strings, it works fine. But at one point it gives a problem. When the replaced string is more than the cell width it is not displayed. Also when i single click on a replaced value the whole text is selected, that means after replacement it doesn't wrap into new line if the text size is large than the cell width. Bcoz i think it is treating it as field not text. i don't know the reason. But when i opened it in Notepad i got something.



{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshf loch0\stshfhich0\stshfbi0\deflang1033\deflangfe103 3{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
{\f36\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}KPN Sans{\*\falt Arial};}{\f177\froman\fcharset238\fprq2 Times New Roman CE;}{\f178\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f180\froman\fcharset161\fprq2 Times New Roman Greek;}
{\f181\froman\fcharset162\fprq2 Times New Roman Tur;}{\f182\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f183\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f184\froman\fcharset186\fprq2 Times New Roman Baltic;}
{\f185\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f187\fswiss\fcharset238\fprq2 Arial CE;}{\f188\fswiss\fcharset204\fprq2 Arial Cyr;}{\f190\fswiss\fcharset161\fprq2 Arial Greek;}{\f191\fswiss\fcharset162\fprq2 Arial Tur;}
{\f192\fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f193\fswiss\fcharset178\fprq2 Arial (Arabic);}{\f194\fswiss\fcharset186\fprq2 Arial Baltic;}{\f195\fswiss\fcharset163\fprq2 Arial (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0 \green0\blue255;
\red0\green255\blue255;\red0\green255\blue0;\red25 5\green0\blue255;\red255\green0\blue0;\red255\gree n255\blue0;\red255\green255\blue255;\red0\green0\b lue128;\red0\green128\blue128;\red0\green128\blue0 ;\red128\green0\blue128;\red128\green0\blue0;
\red128\green128\blue0;\red128\green128\blue128;\r ed192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustri ght\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfen p1033 \snext0 Normal;}{\*\cs10 \additive
\ssemihidden Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpa ddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tsc ellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsb rdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustri ght\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfen p1024 \snext11 \ssemihidden Normal Table;}{\*\cs15 \additive \f1\fs16 \sbasedon10 \styrsid220190 CellTitel;}}
{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rs idtbl \rsid220190}{\*\generator Microsoft Word 11.0.5604;}{\info{\title 01-11-2000 }{\author A113937}{\operator A113937}{\creatim\yr2007\mo3\dy9\hr14\min51}{\revt im\yr2007\mo3\dy9\hr14\min51}{\version1}
{\edmins0}{\nofpages1}{\nofwords5}{\nofchars33}{\* \company Atos Origin}{\nofcharsws37}{\vern24689}}\widowctrl\ftnb j\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsb db\nospaceforul\formshade\horzdoc\dgmargin\dghspac e180\dgvspace180\dghorigin1701
\dgvorigin1984\dghshow1\dgvshow1\jexpand\viewkind4 \viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftn lytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind \lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\sna ptogridincell\allowfieldendsel\wrppunct
\asianbrkrule\rsidroot220190\newtblstyruls\nogrowa utofit \fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sec trsid2296109\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnha ng
{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnha ng {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnha ng
{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhan g {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnha ng {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhan g {\pntxtb (}{\pntxta )}}\pard\plain
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustri ght\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfen p1033 {\field\fldedit{\*\fldinst {\cs15\i\f36\fs14\cf1\insrsid220190 MACROBUTTON QueryVeld 01-11-2000 }}{\fldrslt }}{
\insrsid220190
\par
\par }}

the bold letter filed code remains and it is treated as field, so we need to remove the field code and just keep the column name only. how can i do that.
Mar 9 '07 #38
Hello... I think you should read the rtf as text file , search for your keyword, then you can replace it. Of course you need an output file for writing.
Have you already tried this kind of approach ?
Bye,

diSangro




Now starting with the issue to find and replace strings, it works fine. But at one point it gives a problem. When the replaced string is more than the cell width it is not displayed. Also when i single click on a replaced value the whole text is selected, that means after replacement it doesn't wrap into new line if the text size is large than the cell width. Bcoz i think it is treating it as field not text. i don't know the reason. But when i opened it in Notepad i got something.



{\rtf1\ansi\ansicpg1252\uc1\deff0\stshfdbch0\stshf loch0\stshfhich0\stshfbi0\deflang1033\deflangfe103 3{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;}{\f1\fswiss\fcharset0\fprq2{\*\panose 020b0604020202020204}Arial;}
{\f36\fswiss\fcharset0\fprq2{\*\panose 00000000000000000000}KPN Sans{\*\falt Arial};}{\f177\froman\fcharset238\fprq2 Times New Roman CE;}{\f178\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f180\froman\fcharset161\fprq2 Times New Roman Greek;}
{\f181\froman\fcharset162\fprq2 Times New Roman Tur;}{\f182\froman\fcharset177\fprq2 Times New Roman (Hebrew);}{\f183\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f184\froman\fcharset186\fprq2 Times New Roman Baltic;}
{\f185\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f187\fswiss\fcharset238\fprq2 Arial CE;}{\f188\fswiss\fcharset204\fprq2 Arial Cyr;}{\f190\fswiss\fcharset161\fprq2 Arial Greek;}{\f191\fswiss\fcharset162\fprq2 Arial Tur;}
{\f192\fswiss\fcharset177\fprq2 Arial (Hebrew);}{\f193\fswiss\fcharset178\fprq2 Arial (Arabic);}{\f194\fswiss\fcharset186\fprq2 Arial Baltic;}{\f195\fswiss\fcharset163\fprq2 Arial (Vietnamese);}}{\colortbl;\red0\green0\blue0;\red0 \green0\blue255;
\red0\green255\blue255;\red0\green255\blue0;\red25 5\green0\blue255;\red255\green0\blue0;\red255\gree n255\blue0;\red255\green255\blue255;\red0\green0\b lue128;\red0\green128\blue128;\red0\green128\blue0 ;\red128\green0\blue128;\red128\green0\blue0;
\red128\green128\blue0;\red128\green128\blue128;\r ed192\green192\blue192;}{\stylesheet{\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustri ght\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfen p1033 \snext0 Normal;}{\*\cs10 \additive
\ssemihidden Default Paragraph Font;}{\*\ts11\tsrowd\trftsWidthB3\trpaddl108\trpa ddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tsc ellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsb rdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustri ght\rin0\lin0\itap0 \fs20\lang1024\langfe1024\cgrid\langnp1024\langfen p1024 \snext11 \ssemihidden Normal Table;}{\*\cs15 \additive \f1\fs16 \sbasedon10 \styrsid220190 CellTitel;}}
{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\rs idtbl \rsid220190}{\*\generator Microsoft Word 11.0.5604;}{\info{\title 01-11-2000 }{\author A113937}{\operator A113937}{\creatim\yr2007\mo3\dy9\hr14\min51}{\revt im\yr2007\mo3\dy9\hr14\min51}{\version1}
{\edmins0}{\nofpages1}{\nofwords5}{\nofchars33}{\* \company Atos Origin}{\nofcharsws37}{\vern24689}}\widowctrl\ftnb j\aenddoc\noxlattoyen\expshrtn\noultrlspc\dntblnsb db\nospaceforul\formshade\horzdoc\dgmargin\dghspac e180\dgvspace180\dghorigin1701
\dgvorigin1984\dghshow1\dgvshow1\jexpand\viewkind4 \viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ftn lytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind \lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\sna ptogridincell\allowfieldendsel\wrppunct
\asianbrkrule\rsidroot220190\newtblstyruls\nogrowa utofit \fet0\sectd \linex0\endnhere\sectlinegrid360\sectdefaultcl\sec trsid2296109\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnha ng
{\pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnha ng {\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnha ng
{\pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhan g {\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnha ng {\pntxtb (}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhan g {\pntxtb (}{\pntxta )}}\pard\plain
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustri ght\rin0\lin0\itap0 \fs24\lang1033\langfe1033\cgrid\langnp1033\langfen p1033 {\field\fldedit{\*\fldinst {\cs15\i\f36\fs14\cf1\insrsid220190 MACROBUTTON QueryVeld 01-11-2000 }}{\fldrslt }}{
\insrsid220190
\par
\par }}

the bold letter filed code remains and it is treated as field, so we need to remove the field code and just keep the column name only. how can i do that.
Mar 9 '07 #39
I am posting some code to better explain what I told you.
It looks for QueryVeld keyword and replace the following string with pippopippopippopippopippopippopippopippopippopippo (long enough I hope).
Of course it should be improved , for example if string to find is not present , your output is an exact copy of your input.

Ciao

'--------------------------------------------------VB code----------------------------

Private Sub CommandButton1_Click()
Const ForReading = 1
Dim fs, f, count, cend, myLine ' string count/end,line buffer for file reading
Dim fs1, f1
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile("\New\Input.rtf", ForReading, TristateFalse)

Set fs1 = CreateObject("Scripting.FileSystemObject")
Set f1 = fs1.CreateTextFile("\New\Output.rtf", True)

Dim Sfind 'string to find
Dim SReplace ' String to replace
Sfind = "QueryVeld"
SReplace = "pippopippopippopippopippopippopippopippopippopipp o"
Do
myLine = f.Readline

count = InStr(1, myLine, Sfind, 1)

If count = 0 Then f1.WriteLine myLine ' exact copy of input , SFind not present in myLine

While count <> 0
MsgBox count
f1.Write Mid(myLine, 1, count + Len(Sfind))

cend = InStr(count + Len(Sfind) + 1, myLine, " ", 1)

f1.Write SReplace
f1.Write Mid(myLine, cend, Len(myLine))
'MsgBox Mid(myLine, count, cend - count)
count = InStr(count + Len(Sfind), myLine, Sfind, 1)
Wend
Loop Until myLine = "\par }}" ' buffer which ends the loop

f1.Close
End Sub






Hello... I think you should read the rtf as text file , search for your keyword, then you can replace it. Of course you need an output file for writing.
Have you already tried this kind of approach ?
Bye,

diSangro
Mar 9 '07 #40
amitp
49
The code supplied by u distorts the original format of the table. Also u've read the document up to "\\par" but i want to read the doc upto the end which consists of lot of field value to be replaced. And the original format of the table should remain same.

Can this be possible that i'll open the doc thru word object but delete the field code and remain the text as unchanged so that i can easily replace the text with its value. I want to know how can i delete the field codes thru word.

Thanking You
Mar 12 '07 #41
"\\par" ?
Loop termination occurs with "\par }}" Which is the text ending your file, while "\\par" never occurs.

Can you post your input file having tables and field codes to replace(I mean... as text)?

Bye





The code supplied by u distorts the original format of the table. Also u've read the document up to "\\par" but i want to read the doc upto the end which consists of lot of field value to be replaced. And the original format of the table should remain same.

Can this be possible that i'll open the doc thru word object but delete the field code and remain the text as unchanged so that i can easily replace the text with its value. I want to know how can i delete the field codes thru word.

Thanking You
Mar 12 '07 #42
amitp
49
yes i'm sending my RTF file.

{\rtf1\ansi \deff4\deflang1033{\fonttbl{\f4\froman\fcharset0\f prq2 Times New Roman;}{\f5\fswiss\fcharset0\fprq2 Arial;}{\f70\fswiss\fcharset0\fprq2 KPN Sans{\*\falt Arial};}}{\colortbl;\red0\green0\blue0;\red0\green 0\blue255;
\red0\green255\blue255;\red0\green255\blue0;\red25 5\green0\blue255;\red255\green0\blue0;\red255\gree n255\blue0;\red255\green255\blue255;\red0\green0\b lue128;\red0\green128\blue128;\red0\green128\blue0 ;\red128\green0\blue128;\red128\green0\blue0;
\red128\green128\blue0;\red128\green128\blue128;\r ed192\green192\blue192;}{\stylesheet{\nowidctlpar \f4\fs20\lang2057 \snext0 Normal;}{\s1\sb240\sa60\keepn\nowidctlpar \b\f5\fs28\lang2057\kerning28 \sbasedon0\snext0 heading 1;}{
\s2\sb240\sa60\keepn\nowidctlpar \b\i\f5\lang2057 \sbasedon0\snext0 heading 2;}{\*\cs10 \additive Default Paragraph Font;}{\s15\nowidctlpar\tqc\tx4536\tqr\tx9072 \f4\fs20\lang2057 \sbasedon0\snext15 header;}{\*\cs16 \additive\f5\fs16 \sbasedon10
CellTitel;}{\*\cs17 \additive\fs22 \sbasedon16 CellTitelGroot;}{\s18\nowidctlpar\tqc\tx4536\tqr\t x9072 \f4\fs20\lang2057 \sbasedon0\snext18 footer;}{\s19\sb120\sa120\nowidctlpar \b\f4\fs20\lang2057 \sbasedon0\snext0 caption;}}{\info{\title Klantgegevens}
{\author T-Werkplek}{\operator T-Werkplek}{\creatim\yr1998\mo6\dy10\hr14\min36}{\re vtim\yr2002\mo9\dy19\hr11\min22}{\printim\yr1997\m o3\dy11\hr14\min10}{\version2}{\edmins0}{\nofpages 1}{\nofwords126}{\nofchars720}{\*\company PTT Telecom I&AT}{\vern57395}}
\paperw11907\paperh16840\margl510\margr510\margt43 1\margb431 \widowctrl\ftnbj\aenddoc\hyphhotz425\hyphcaps0\for mshade \fet0\sectd \psz9\linex0\headery284\footery369\colsx709\endnhe re {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\ pntxta .}}
{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{ \pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnha ng{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}
{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{ \pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhan g{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnha ng{\pntxtb (}{\pntxta )}}{\*\pnseclvl9
\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\trowd \trgaph56\trleft-56 \clbrdrt\brdrs\brdrw15 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx6036\clbrdrt\brdrs\brdrw15 \cellx6283\clbrdrt\brdrs\brdrw15 \clbrdrb
\brdrs\brdrw15 \cellx11143 \pard\plain \keepn\widctlpar\intbl \f4\fs20\lang2057 {\cs16\b\f70\fs16\lang19 Klantgegevens\cell }{\cs16\f70\fs14\lang19 Naam en voorletters of bedrijfsnaam contractant
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_naam>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Naam en voorletters of bedrijfsnaam gebruiker
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_naam_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\b\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \clbrdrb
\brdrs\brdrw15 \cellx6036\cellx6283\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19 Adres}{\cs16\i\f70\fs14\lang19
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_adres>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Aansluitadres
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_aansluitadres>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19
Postcode en woonplaats
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_pc_wpl>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Postcode en woonplaats
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_pc_wpl_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \clbrdrb
\brdrs\brdrw15 \cellx6036\cellx6283\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx8484\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19 Land
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_land_zip>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Land
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_land_zip_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15
\clbrdrb\brdrs\brdrw15 \cellx3925\cellx6036\cellx6283\clbrdrt\brdrs\brdrw 15 \clbrdrb\brdrs\brdrw15 \cellx8484\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19
Contactpersoon
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_cp>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell Telefoonnummer
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_tel>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Contactpersoon
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_cp_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell Telefoonnummer
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_tel_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \cellx6036
\cellx6283\clbrdrt\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19 Inschr.nr. KVK
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_nr_kvk>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Nieuw adres bij verhuizing
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_adres_verh>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\pard \nowidctlpar
\par }


The bold letter are the filed codes which remain in the RTF file after the replacement of "<<s_naam>>" like fields with their respective values (For which i was using Word object Find and Replacement method) . So there are number of field codes but i've highlighted only one. If i'll be able to remove the highlighted one from the file then the replaced value will be treated as plain text and will be wrapped if the text lenght is greater than the cell length. I want the table format to be remain as before.

Also if there are any way to remove the field code without reading the file in text mode i.e opening the file thru WORD which i was previously using.
Thanking You
Mar 12 '07 #43
'So if I am correct you want to replace field codes with long (normal text) names 'cause they don't fit your tables... and you want to use Word objects.

'Remember the FindReplace Sub I posted some time ago ?
'After:

Set wrdDoc = wrdApp.Documents.Open(Inputfile)

'Put the line:

Sfind = "^dMACROBUTTON QueryVeld " & Sfind

'And see what happens!
'Does it help?

' diSangro








yes i'm sending my RTF file.

{\rtf1\ansi \deff4\deflang1033{\fonttbl{\f4\froman\fcharset0\f prq2 Times New Roman;}{\f5\fswiss\fcharset0\fprq2 Arial;}{\f70\fswiss\fcharset0\fprq2 KPN Sans{\*\falt Arial};}}{\colortbl;\red0\green0\blue0;\red0\green 0\blue255;
\red0\green255\blue255;\red0\green255\blue0;\red25 5\green0\blue255;\red255\green0\blue0;\red255\gree n255\blue0;\red255\green255\blue255;\red0\green0\b lue128;\red0\green128\blue128;\red0\green128\blue0 ;\red128\green0\blue128;\red128\green0\blue0;
\red128\green128\blue0;\red128\green128\blue128;\r ed192\green192\blue192;}{\stylesheet{\nowidctlpar \f4\fs20\lang2057 \snext0 Normal;}{\s1\sb240\sa60\keepn\nowidctlpar \b\f5\fs28\lang2057\kerning28 \sbasedon0\snext0 heading 1;}{
\s2\sb240\sa60\keepn\nowidctlpar \b\i\f5\lang2057 \sbasedon0\snext0 heading 2;}{\*\cs10 \additive Default Paragraph Font;}{\s15\nowidctlpar\tqc\tx4536\tqr\tx9072 \f4\fs20\lang2057 \sbasedon0\snext15 header;}{\*\cs16 \additive\f5\fs16 \sbasedon10
CellTitel;}{\*\cs17 \additive\fs22 \sbasedon16 CellTitelGroot;}{\s18\nowidctlpar\tqc\tx4536\tqr\t x9072 \f4\fs20\lang2057 \sbasedon0\snext18 footer;}{\s19\sb120\sa120\nowidctlpar \b\f4\fs20\lang2057 \sbasedon0\snext0 caption;}}{\info{\title Klantgegevens}
{\author T-Werkplek}{\operator T-Werkplek}{\creatim\yr1998\mo6\dy10\hr14\min36}{\re vtim\yr2002\mo9\dy19\hr11\min22}{\printim\yr1997\m o3\dy11\hr14\min10}{\version2}{\edmins0}{\nofpages 1}{\nofwords126}{\nofchars720}{\*\company PTT Telecom I&AT}{\vern57395}}
\paperw11907\paperh16840\margl510\margr510\margt43 1\margb431 \widowctrl\ftnbj\aenddoc\hyphhotz425\hyphcaps0\for mshade \fet0\sectd \psz9\linex0\headery284\footery369\colsx709\endnhe re {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\ pntxta .}}
{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{ \pntxta .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnha ng{\pntxta )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb (}{\pntxta )}}
{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{ \pntxtb (}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhan g{\pntxtb (}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnha ng{\pntxtb (}{\pntxta )}}{\*\pnseclvl9
\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb (}{\pntxta )}}\trowd \trgaph56\trleft-56 \clbrdrt\brdrs\brdrw15 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx6036\clbrdrt\brdrs\brdrw15 \cellx6283\clbrdrt\brdrs\brdrw15 \clbrdrb
\brdrs\brdrw15 \cellx11143 \pard\plain \keepn\widctlpar\intbl \f4\fs20\lang2057 {\cs16\b\f70\fs16\lang19 Klantgegevens\cell }{\cs16\f70\fs14\lang19 Naam en voorletters of bedrijfsnaam contractant
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_naam>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Naam en voorletters of bedrijfsnaam gebruiker
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_naam_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\b\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \clbrdrb
\brdrs\brdrw15 \cellx6036\cellx6283\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19 Adres}{\cs16\i\f70\fs14\lang19
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_adres>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Aansluitadres
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_aansluitadres>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19
Postcode en woonplaats
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_pc_wpl>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Postcode en woonplaats
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_pc_wpl_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \clbrdrb
\brdrs\brdrw15 \cellx6036\cellx6283\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx8484\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19 Land
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_land_zip>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Land
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_land_zip_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15
\clbrdrb\brdrs\brdrw15 \cellx3925\cellx6036\cellx6283\clbrdrt\brdrs\brdrw 15 \clbrdrb\brdrs\brdrw15 \cellx8484\clbrdrt\brdrs\brdrw15 \clbrdrb\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19
Contactpersoon
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_cp>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell Telefoonnummer
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_tel>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Contactpersoon
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_cp_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell Telefoonnummer
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_tel_gebr>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\trowd \trgaph56\trleft-56 \clshdng2000 \cellx1362\clbrdrt\brdrs\brdrw15 \cellx6036
\cellx6283\clbrdrt\brdrs\brdrw15 \cellx11143 \pard \keepn\widctlpar\intbl {\cs16\b\f70\lang19 \cell }{\cs16\f70\fs14\lang19 Inschr.nr. KVK
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_nr_kvk>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell \cell Nieuw adres bij verhuizing
\par }{\field\flddirty{\*\fldinst {\i\f70\fs14 MACROBUTTON QueryVeld <<s_adres_verh>> }}{\fldrslt }}{\cs16\f70\fs14\lang19 \cell }\pard \widctlpar\intbl {\cs16\f70\lang19 \row }\pard \nowidctlpar
\par }


The bold letter are the filed codes which remain in the RTF file after the replacement of "<<s_naam>>" like fields with their respective values (For which i was using Word object Find and Replacement method) . So there are number of field codes but i've highlighted only one. If i'll be able to remove the highlighted one from the file then the replaced value will be treated as plain text and will be wrapped if the text lenght is greater than the cell length. I want the table format to be remain as before.

Also if there are any way to remove the field code without reading the file in text mode i.e opening the file thru WORD which i was previously using.
Thanking You
Mar 13 '07 #44
amitp
49
According to u i need to read the RTF file as plain text file line by line. Consider 'MyLine ' in which i'm reading a file line by line. If there is a text "<<s_naam>>" present in the line which is another file name. I want to replace "<<s_naam>>" with its whole content. How can i do that. Can this code will be do.

Actually my requirement is that previously my RTF file has only field names which is to be replaced by a value. But now the RTF file consists of field names which are another file names. So i need to replace the field name with the whole content of another file so that the files will be appended. I tried this but in some case it works fine but there comes a blank line between two files and in some case the file becomes corrupt. Need ur help. Thanx in Advance.

Set FsamIn = CreateObject("Scripting.FileSystemObject")
Set F1In = FsIn.OpenTextFile(s_naam, ForReading, TristateFalse)
lsWholeFile = F1In.ReadAll
lsMyLine = Replace(lsMyLine, "<<s_naam>>", lsWholeFile)
Mar 13 '07 #45
Well...that's not really what I said;

I posted the code for Sub FindReplace(...)

This Sub treats the rtf as Word object (NOT as text file!) and replaces field codes as follows:

-deactivate field codes
-replace the searched string (i.e.: a field code name)
-activate your field codes again

then I think you have problems in viewing replaced field code names due to their lenght, when lenght exceeds the cell lenght of your table you cant see them.
This is because field codes cant be viewed on more lines, even if you put a newline inside it.
So you should replace a field code with a normal text string, in this way your text can be viewed on more lines.

To do this I suggested to use Sub FindReplace(...) adding the line:

Sfind = "^dMACROBUTTON QueryVeld " & Sfind

Just after opening your rtf file as Word object (NOT as text file!).
Then even if you use:

Sreplace = "pippopippopippopippopippopippopippopippopippopipp opippopippopippopippopippopippo"


Your field code name (still passed through Sfind as parameter) will be replaced with the text string Sreplace, which, being normal text, can be displayed on more lines.


You can also pass Sreplace as a string comin from a text file, this shouldn't be a problem.

diSangro

According to u i need to read the RTF file as plain text file line by line. Consider 'MyLine ' in which i'm reading a file line by line. If there is a text "<<s_naam>>" present in the line which is another file name. I want to replace "<<s_naam>>" with its whole content. How can i do that. Can this code will be do.

Actually my requirement is that previously my RTF file has only field names which is to be replaced by a value. But now the RTF file consists of field names which are another file names. So i need to replace the field name with the whole content of another file so that the files will be appended. I tried this but in some case it works fine but there comes a blank line between two files and in some case the file becomes corrupt. Need ur help. Thanx in Advance.

Set FsamIn = CreateObject("Scripting.FileSystemObject")
Set F1In = FsIn.OpenTextFile(s_naam, ForReading, TristateFalse)
lsWholeFile = F1In.ReadAll
lsMyLine = Replace(lsMyLine, "<<s_naam>>", lsWholeFile)
Mar 13 '07 #46
amitp
49
i tried this but this is not working at all. Could u answer my next question in which i'm opening the RTF file as text file. Bcoz if i use WORD object it takes around 5-10 minutes to generate the whole report. So i want to use the FILESYSTEMOBJECT. Thanking You
Mar 13 '07 #47
'Complete code ( please dont say it doesn't work cause it does on my pc) :

Expand|Select|Wrap|Line Numbers
  1. Sub FieldCode_onoff(wrdDoc As Variant, onoff As Boolean)
  2.  
  3. wrdDoc.ActiveWindow.View.ShowFieldCodes = Not wrdDoc.ActiveWindow.View.ShowFieldCodes
  4. wrdDoc.Application.DisplayStatusBar = True
  5. wrdDoc.Application.ShowWindowsInTaskbar = True
  6. wrdDoc.Application.ShowStartupDialog = True
  7. With wrdDoc.ActiveWindow
  8. .DisplayHorizontalScrollBar = True
  9. .DisplayVerticalScrollBar = True
  10. .DisplayLeftScrollBar = False
  11. .StyleAreaWidth = InchesToPoints(0)
  12. .DisplayVerticalRuler = True
  13. .DisplayRightRuler = False
  14. .DisplayScreenTips = True
  15. With wrdDoc.ActiveWindow.View
  16. .ShowAnimation = True
  17. .Draft = False
  18. .WrapToWindow = False
  19. .ShowPicturePlaceHolders = False
  20. .ShowFieldCodes = onoff
  21. .ShowBookmarks = False
  22. .FieldShading = wdFieldShadingWhenSelected
  23. .ShowTabs = False
  24. .ShowSpaces = False
  25. .ShowParagraphs = False
  26. .ShowHyphens = False
  27. .ShowHiddenText = False
  28. .ShowAll = False
  29. .ShowDrawings = True
  30. .ShowObjectAnchors = False
  31. .ShowTextBoundaries = False
  32. .ShowHighlight = True
  33. .DisplayPageBoundaries = True
  34. .DisplaySmartTags = True
  35. End With
  36. End With
  37. End Sub
  38. '-----------------------------------------------------------------------------
  39.  
  40.  
  41. Sub FindReplace(ByVal Sfind As String, ByVal Sreplace As String, ByVal Inputfile As String, ByVal Outputfile As String)
  42.  
  43. Set wrdApp = CreateObject("Word.Application")
  44. wrdApp.Visible = True
  45. Set wrdDoc = wrdApp.Documents.Open(Inputfile)
  46.  
  47. Sfind = "^dMACROBUTTON QueryVeld " & Sfind
  48.  
  49. Call FieldCode_onoff(wrdDoc, True)
  50.  
  51.  
  52. wrdApp.Application.Selection.Find.ClearFormatting
  53. wrdApp.Application.Selection.Find.Replacement.ClearFormatting
  54.  
  55. With wrdApp.Selection.Find
  56. .Text = Sfind
  57. .Replacement.Text = Sreplace
  58. .Forward = True
  59. .Wrap = wdFindContinue
  60. .Format = False
  61. .MatchCase = False
  62. .MatchWholeWord = False
  63. .MatchKashida = False
  64. .MatchDiacritics = False
  65. .MatchAlefHamza = False
  66. .MatchControl = False
  67. .MatchWildcards = False
  68. .MatchSoundsLike = False
  69. .MatchAllWordForms = False
  70. End With
  71. wrdApp.Application.Selection.Find.Execute Replace:=wdReplaceAll
  72. Call FieldCode_onoff(wrdDoc, False)
  73. ' Save to ouput file
  74. With wrdDoc
  75. .SaveAs (Outputfile)
  76. .Close ' close the document
  77. End With
  78. wrdApp.Quit ' close the Word application
  79. Set wrdDoc = Nothing
  80. Set wrdApp = Nothing
  81.  
  82.  
  83. End Sub
  84. '----------------------------------------------How to use:
  85.  
  86. Private Sub CommandButton1_Click()
  87.  
  88. Dim wrdApp As Word.Application
  89. Dim IFile, OFile As String
  90. Dim Sfind, Sreplace
  91. IFile = "\NEW\Minchione.rtf" ' an existing rtf file in c:\NEW\ where Sfind occurs
  92. OFile = "\NEW\Minchione2.rtf"
  93. Sfind = "<<s_naam>>" ' string to find
  94. Sreplace = "pippopippopippopippopippopippopippopippopippopippopippopippopippopippopippo" ' string to replace
  95.  
  96. Call FindReplace(Sfind, Sreplace, IFile, OFile)
  97. End Sub
  98.  
  99. 'Using the last Sub I could replace <<s_naam>> with:
  100. 'pippopippopippopippopippopippopippopippopippopippopippopippopippopippopippo
  101. 'displayed on 2 lines
i tried this but this is not working at all. Could u answer my next question in which i'm opening the RTF file as text file. Bcoz if i use WORD object it takes around 5-10 minutes to generate the whole report. So i want to use the FILESYSTEMOBJECT. Thanking You
Mar 13 '07 #48
amitp
49
Thank u very much. This is working fine. Actually i wanted to read the RTF file as text file. So i have a problem while reading. I want to append a RTF file at the end of the other. But before attaching i want to remove the last text "\par }" of the first file and then attach the same file just after that. but i don't know how to do that. I read the input file to a output file like this. I think u know the RTF text file, i've posted to in earlier reply.

---opening the Input File
Set fs = CreateObject("Scripting.FileSystemObject")
Set F = fs.OpenTextFile(lsInFile, ForReading, TristateFalse)

----Creating a blank output file to write
Set Fs1 = CreateObject("Scripting.FileSystemObject")
Set F1 = Fs1.CreateTextFile(lsOutFile, ForAppending)

Do While F.AtEndOfStream <> True
myLine = F.ReadLine
F1.Write myLine
Loop

Now I want to write file F again at the end of F1. So before doing this i need to remove the last text of F1 "\par }" from it. How can i do that. Need ur help.Thanking You
Mar 14 '07 #49

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Moosebumps | last post by:
So say I am working on two separate .py files in IDLE that are part of the same program. Does anyone have problems where when you modify one file, and then run the other, the changes you made in...
4
by: Jerry | last post by:
I'm having just a bit of trouble wrapping my brain around the task of working with folders that are above the site's root folder. I let users upload photos (.jpg/.gif files) which can...
14
by: Mark B | last post by:
Our webhost (www.usbusinessweb.net) had a W2K IIS5 server crash after a scheduled hard-boot occurred during a ms-security patch install overnight. They couldn't get the server working again so they...
6
by: Matt Frame | last post by:
I have a client that has asked us to get a digital signature certificate and start digitally signing all files we pass between each other. I have heard of the subject and know about the certs but...
4
by: Axter | last post by:
Sorry for OT question, but does any one have a working *.bat file to get Comeau to work with VC++ 7.1, VC++ 8.0, or GNU 3.x compilers. I've tried everything I can think off, to get it to work,...
1
by: saturday | last post by:
I was having problems getting mysql to work with php on my apache server. Thankfully I got it working after reading a different thread, which had me copy over the libmysql file to the apache/bin...
0
by: George2 | last post by:
Hello everyone, From the definition of working set, it is a subset of virtual pages resident in physical memory -- from book Windows Internals. It means working set could not be larger than...
5
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I have a machine running IIS 6.0. I just replaced the web.config and several aspx pages in the application and now the style sheets are not working. the images from the themes work but not the css...
3
by: Seth Williams | last post by:
I have done some new development on older files, locally - then I copy the files, along with the .vb files for the webservices, to our DEV server. Now, mysteriously, no web services are running - I...
6
by: josequinonesii | last post by:
I've searched, I've read, I've tested and re-read numerous post but to no avail yet... Quite simply, the settings I've applied to my httpd.conf, httpd-vhost.conf and my hosts files simply does not...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.