Following is the VBA Code
Sub Impor_XML_Data()
'Code By Kamal Bharkahda
Application.ScreenUpdating = False
Dim TargetSheet As Worksheet
Dim ChooseFIle As Variant
Dim TargetSheetName As String
Dim TargetCellAddress As String
TargetSheetName = Application.InputBox("Write a Sheet Name where you want to place the XML Data ***Case Sensitive***", "Target Sheet Name")
TargetCellAddress = Application.InputBox("Write a Cell Address from where XML Data Start Placing", "Target Cell Address")
Set TargetSheet = ThisWorkbook.Sheets(TargetSheetName)
TargetSheet.UsedRange.Clear
ChooseFIle = Application.GetOpenFilename("XML File (*.xml), *.xml", , "Kamal Bharakhda", , False)
If ChooseFIle = vbNullString Then Exit Sub
ThisWorkbook.XmlImport Url:=ChooseFIle, ImportMap:=Nothing, Overwrite:=True, Destination:=TargetSheet.Range(TargetCellAddress)
MsgBox "Import Done"
Set TargetSheet = Nothing
Application.ScreenUpdating = True
End Sub
No comments:
Post a Comment