silverback24
Board Regular
- Joined
- Jul 30, 2013
- Messages
- 58
I am trying to put together an excel workbook that our customer service can fill in a spreadsheet and then convert all the data to XML and put into a folder. The issue comes in that we can have up to 12 parts included in the item field. The XML maps this as a vertical drop down as opposed to a horizontal spreadsheet.
Thanks in advance! Sorry for wall of text.
<sbcpartorderrequest><shipto><state>XML won't paste with code.
</state></shipto></sbcpartorderrequest>
I have a macro put together, that works, but saves them as text files. Is there a way to convert my macro to save as XML or is there another way to do this?
Macro:
Sub Macro1()
'
' Macro1 Macro
'
'
Dim n As Integer
Dim r As Integer
Dim Fname As String
n = 1
r = 2
'Data filled in by reps will be horizontal, then transpose pasted into another sheet with the xml prefix and suffix in columns A and C
Workbooks("Credit Memo Workbook.XLSM").Activate
Sheets("Credit Memo Data").Select
For Each Cell In Sheets("Credit Memo Data").Range("C2:C500")
If Cell.Value = "CREDIT" Then
Fname = "H:\Desktop\" & "CRDA " & Format(Date, "ddmmyyyy") & " - " & n & ".txt"
Sheets("Credit Memo Data").Select
Rows(r & ":" & r).Select
Selection.Copy
Sheets("Credit Memo Build Sheet").Select
Range("B1").Select
Sheets("Credit Memo Build Sheet").Range("B1").PasteSpecial Paste:=xlPasteValues, Transpose:=True
'Paste to a new workbook
'column D has a concatenate formula pulling columns A,B,C
Worksheets("Credit Memo Build Sheet").Range("D:D").Copy
Workbooks.Add
Sheets("Sheet1").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:=Fname, FileFormat:=xlText
ActiveWorkbook.Close SaveChanges:=False
n = n + 1
r = r + 1
Else
Exit Sub
End If
Next
End Sub
Thanks in advance! Sorry for wall of text.
<sbcpartorderrequest><shipto><state>XML won't paste with code.
</state></shipto></sbcpartorderrequest>
I have a macro put together, that works, but saves them as text files. Is there a way to convert my macro to save as XML or is there another way to do this?
Macro:
Sub Macro1()
'
' Macro1 Macro
'
'
Dim n As Integer
Dim r As Integer
Dim Fname As String
n = 1
r = 2
'Data filled in by reps will be horizontal, then transpose pasted into another sheet with the xml prefix and suffix in columns A and C
Workbooks("Credit Memo Workbook.XLSM").Activate
Sheets("Credit Memo Data").Select
For Each Cell In Sheets("Credit Memo Data").Range("C2:C500")
If Cell.Value = "CREDIT" Then
Fname = "H:\Desktop\" & "CRDA " & Format(Date, "ddmmyyyy") & " - " & n & ".txt"
Sheets("Credit Memo Data").Select
Rows(r & ":" & r).Select
Selection.Copy
Sheets("Credit Memo Build Sheet").Select
Range("B1").Select
Sheets("Credit Memo Build Sheet").Range("B1").PasteSpecial Paste:=xlPasteValues, Transpose:=True
'Paste to a new workbook
'column D has a concatenate formula pulling columns A,B,C
Worksheets("Credit Memo Build Sheet").Range("D:D").Copy
Workbooks.Add
Sheets("Sheet1").Activate
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
ActiveWorkbook.SaveAs Filename:=Fname, FileFormat:=xlText
ActiveWorkbook.Close SaveChanges:=False
n = n + 1
r = r + 1
Else
Exit Sub
End If
Next
End Sub
Last edited: