S
shinde.shailesh
Hi All,
I am runnning Macro with Passolo.
I have to .mdb file with Table name "lemmas" and one field "lemma".
Here I want to put data from Passolo translist into "lemma" this list
contains source string and traget string, source string means data in
english language and target string means data in german/localized
language.
For the same i have done with Storing data in Excel and trying to do
the same in MS Access.
EXCEL:
Below is the code and output.
Sub Main
'Get a translation list
Dim trn As PslTransList
Dim srn As PslSourceList
Set trn = PSL.ActiveProject.TransLists(1)
If trn Is Nothing Then Exit Sub
'Open Excel And create a workbook
Dim ex As Object
Set ex = CreateObject("Excel.Application")
Dim wb As Object
Set wb = ex.Workbooks.Add
'Set wb = ex.ActiveWorkBook
Dim j As Long
Dim i As Long
For i = 1 To trn.StringCount
j = 2*i
With wb.ActiveSheet
.Range("a" & CStr(j - 1)) = trn.String(i).SourceText
.Range("a" & CStr(j)) = trn.String(i).Text
End With
Next i
ex.Quit
End Sub
And Output :
Column A
Invalid Currency. (Source string)
Ungültige Währung. (Target string)
Invalid DateTime.
Ungültiges Datum oder ungültige Zeit.
Invalid DateTimeSpan.
Ungültige Datums- oder Zeitspanne.
Invalid filename.
Ungültiger Dateiname.
Failed to open document.
Fehler beim Öffnen des Dokuments.
Failed to save document.
Fehler beim Speichern des Dokuments.
So the same output i need in Access, means source string in one row and
in next row target string. In one field (lemma) source and target
strings.
For the same I have done like:
Sub Main
' Get a translation list
Dim trn As PslTransList
Set trn = PSL.ActiveProject.TransLists(1)
If trn Is Nothing Then Exit Sub
Dim x As Long
Dim Db1 As DAO.Database
Dim Rs1 As DAO.Recordset
Set Db1 = DBEngine.OpenDatabase("access_schema.mdb")
Set Rs1 = Db1.OpenRecordset("Lemmas",dbOpenTable)
For x = 1 To trn.StringCount
With Rs1
..AddNew
..Fields("Lemma") = trn.String(x).SourceText 'Adding source strings to
Database
'.Fields("Lemma") = trn.String(x).Text 'Adding Target
strings to Database
..Update
End With
Next
Db1.Close
End Sub
With this code I can able to store source string in field "lemma" but
can able to store target string in next row of field "lemma"
Can anyone help with this?
Thanks,
Shailesh
I am runnning Macro with Passolo.
I have to .mdb file with Table name "lemmas" and one field "lemma".
Here I want to put data from Passolo translist into "lemma" this list
contains source string and traget string, source string means data in
english language and target string means data in german/localized
language.
For the same i have done with Storing data in Excel and trying to do
the same in MS Access.
EXCEL:
Below is the code and output.
Sub Main
'Get a translation list
Dim trn As PslTransList
Dim srn As PslSourceList
Set trn = PSL.ActiveProject.TransLists(1)
If trn Is Nothing Then Exit Sub
'Open Excel And create a workbook
Dim ex As Object
Set ex = CreateObject("Excel.Application")
Dim wb As Object
Set wb = ex.Workbooks.Add
'Set wb = ex.ActiveWorkBook
Dim j As Long
Dim i As Long
For i = 1 To trn.StringCount
j = 2*i
With wb.ActiveSheet
.Range("a" & CStr(j - 1)) = trn.String(i).SourceText
.Range("a" & CStr(j)) = trn.String(i).Text
End With
Next i
ex.Quit
End Sub
And Output :
Column A
Invalid Currency. (Source string)
Ungültige Währung. (Target string)
Invalid DateTime.
Ungültiges Datum oder ungültige Zeit.
Invalid DateTimeSpan.
Ungültige Datums- oder Zeitspanne.
Invalid filename.
Ungültiger Dateiname.
Failed to open document.
Fehler beim Öffnen des Dokuments.
Failed to save document.
Fehler beim Speichern des Dokuments.
So the same output i need in Access, means source string in one row and
in next row target string. In one field (lemma) source and target
strings.
For the same I have done like:
Sub Main
' Get a translation list
Dim trn As PslTransList
Set trn = PSL.ActiveProject.TransLists(1)
If trn Is Nothing Then Exit Sub
Dim x As Long
Dim Db1 As DAO.Database
Dim Rs1 As DAO.Recordset
Set Db1 = DBEngine.OpenDatabase("access_schema.mdb")
Set Rs1 = Db1.OpenRecordset("Lemmas",dbOpenTable)
For x = 1 To trn.StringCount
With Rs1
..AddNew
..Fields("Lemma") = trn.String(x).SourceText 'Adding source strings to
Database
'.Fields("Lemma") = trn.String(x).Text 'Adding Target
strings to Database
..Update
End With
Next
Db1.Close
End Sub
With this code I can able to store source string in field "lemma" but
can able to store target string in next row of field "lemma"
Can anyone help with this?
Thanks,
Shailesh