DragonWood
10-02-2017, 02:08 PM
Greetings,
I am trying to export the customer information from my Excel file to a XML file.
I tried using the same export code I’ve used for both exporting to PDF and to Text file. However, it’s not working.
Note: This code works fine for the text and PDF export. It just doesn't work for XML.
Public Sub ExportDailyActivities()
'Exports the data to the Daily Activities.txt file and puts it in the same directory as this Workbook
Application.ScreenUpdating = False
With Sheets("Daily Activities")
Dim intDACount As Integer
Dim lngRow As Long
Dim lngCount As Long
Dim strFile As String
strFile = ThisWorkbook.Path & "\" & "Daily Activities.txt"
lngRow = Range("B" & Rows.Count).End(xlUp).Row
intDACount = FreeFile
Open strFile For Output As #intDACount
For lngCount = 1 To lngRow
Print #intDACount, .Range("A" & lngCount).Value; vbTab; .Range("B" & lngCount).Value; vbTab; .Range("C" & lngCount).Value; vbTab; .Range("D" & lngCount).Value; vbTab; .Range("E" & lngCount).Value
Next lngCount
Close #intDACount
End With
Application.ScreenUpdating = True
End Sub
I would appreciate some help.
Thanks.
I am trying to export the customer information from my Excel file to a XML file.
I tried using the same export code I’ve used for both exporting to PDF and to Text file. However, it’s not working.
Note: This code works fine for the text and PDF export. It just doesn't work for XML.
Public Sub ExportDailyActivities()
'Exports the data to the Daily Activities.txt file and puts it in the same directory as this Workbook
Application.ScreenUpdating = False
With Sheets("Daily Activities")
Dim intDACount As Integer
Dim lngRow As Long
Dim lngCount As Long
Dim strFile As String
strFile = ThisWorkbook.Path & "\" & "Daily Activities.txt"
lngRow = Range("B" & Rows.Count).End(xlUp).Row
intDACount = FreeFile
Open strFile For Output As #intDACount
For lngCount = 1 To lngRow
Print #intDACount, .Range("A" & lngCount).Value; vbTab; .Range("B" & lngCount).Value; vbTab; .Range("C" & lngCount).Value; vbTab; .Range("D" & lngCount).Value; vbTab; .Range("E" & lngCount).Value
Next lngCount
Close #intDACount
End With
Application.ScreenUpdating = True
End Sub
I would appreciate some help.
Thanks.