Option
Explicit
#If Win64 Then
Private
Declare
PtrSafe
Function
WritePrivateProfileStringA
Lib
"kernel32.dll"
( _
ByVal
lpApplicationName
As
String
, _
ByVal
lpKeyName
As
Any, _
ByVal
lpString
As
Any, _
ByVal
lpFileName
As
String
)
As
Long
Private
Declare
PtrSafe
Function
GetPrivateProfileStringA
Lib
"kernel32.dll"
( _
ByVal
lpApplicationName
As
String
, _
ByVal
lpKeyName
As
Any, _
ByVal
lpDefault
As
String
, _
ByVal
lpReturnedString
As
String
, _
ByVal
nSize
As
Long
, _
ByVal
lpFileName
As
String
)
As
Long
#Else
Private
Declare
Function
WritePrivateProfileStringA
Lib
"kernel32.dll"
( _
ByVal
lpApplicationName
As
String
, _
ByVal
lpKeyName
As
Any, _
ByVal
lpString
As
Any, _
ByVal
lpFileName
As
String
)
As
Long
Private
Declare
Function
GetPrivateProfileStringA
Lib
"kernel32.dll"
( _
ByVal
lpApplicationName
As
String
, _
ByVal
lpKeyName
As
Any, _
ByVal
lpDefault
As
String
, _
ByVal
lpReturnedString
As
String
, _
ByVal
nSize
As
Long
, _
ByVal
lpFileName
As
String
)
As
Long
#End If
Const
FILENAME
As
String
=
"C:\Test\test.txt"
Sub
TXT_Exportieren()
Dim
lngZeile
As
Long
For
lngZeile = 2
To
ActiveSheet.UsedRange.Rows.Count
If
Not
IsEmpty(Cells(lngZeile, 2))
Then
Call
WritePrivateProfileStringA(
"W"
&
CStr
(lngZeile - 1),
"keywords"
,
CStr
(Cells(lngZeile, 1).Text), FILENAME)
Call
WritePrivateProfileStringA(
"W"
&
CStr
(lngZeile - 1),
"command"
,
CStr
(Cells(lngZeile, 2).Text), FILENAME)
If
Not
IsEmpty(Cells(lngZeile, 3))
Then
Call
WritePrivateProfileStringA(
"W"
&
CStr
(lngZeile - 1),
"parameter"
,
CStr
(Cells(lngZeile, 3).Text), FILENAME)
End
If
End
If
Next
End
Sub