Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default read datas from XML to excel using VBAmacros

hi, i am newbie to this environment.i have one button in my ExcelWorkbook.i
have sample.xml in my "c:\" i want to read that sample.xml and disply in my
Excel Workbook if i click the button using VBA macro programing.please can
any one show some exmple to do this please
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default read datas from XML to excel using VBAmacros


"born2achieve" schreef in bericht
...
hi, i am newbie to this environment.i have one button in my
ExcelWorkbook.i
have sample.xml in my "c:\" i want to read that sample.xml and disply in
my
Excel Workbook if i click the button using VBA macro programing.please
can
any one show some exmple to do this please



A Button event to open the xml-file looks like this:

Public Sub OpenXML()
Workbooks.Open ("C:\sample.xml")
End Sub

This way the file will be opened in a new Excel window.
All you have to do is copy and paste the xml-data if you want it to be
displayed in a workbook that's already open.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default read datas from XML to excel using VBAmacros


DEar Friend,
i have tried this, but i cooldnot do this please help me to do this please
code:

Dim eMessage As String
Dim xlApp As Excel.Application

'AppActivate("Microsoft Excel")
'xlApp = GetObject(, "Excel.Application")
xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.OpenXML("C:\sample .xml")

ChDir("C:\")
xlApp.AlertBeforeOverwriting = False
xlApp.DisplayAlerts = False
xlApp.ActiveWorkbook.SaveAs(Filename:="C:\sample .xls")
xlApp.AlertBeforeOverwriting = True
xlApp.DisplayAlerts = True

If Not xlApp Is Nothing Then
xlApp.Quit()
xlApp = Nothing

End If

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default read datas from XML to excel using VBAmacros


"born2achieve" schreef in bericht
...

DEar Friend,
i have tried this, but i cooldnot do this please help me to do this
please
code:

Dim eMessage As String
Dim xlApp As Excel.Application

'AppActivate("Microsoft Excel")
'xlApp = GetObject(, "Excel.Application")
xlApp = CreateObject("Excel.Application")
xlApp.Workbooks.OpenXML("C:\sample .xml")

ChDir("C:\")
xlApp.AlertBeforeOverwriting = False
xlApp.DisplayAlerts = False
xlApp.ActiveWorkbook.SaveAs(Filename:="C:\sample .xls")
xlApp.AlertBeforeOverwriting = True
xlApp.DisplayAlerts = True

If Not xlApp Is Nothing Then
xlApp.Quit()
xlApp = Nothing

End If


You are working with so called 'objects' and you can not assign a value to
an object by saying i.e.
xlApp = CreateObject("Excel.Application")

Instead you should use Set, so for all objects it should be:

Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Application")

....and in the end also:

Set xlApp = Nothing


Please try that and let me know what happens.


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Counting datas in one range based on datas in another range Irene Excel Discussion (Misc queries) 1 November 11th 08 11:51 PM
import datas from one excel to another Krishnakanth New Users to Excel 1 May 2nd 07 06:19 PM
How can I get excel datas in mailing labels? pwilcke Excel Discussion (Misc queries) 1 January 25th 07 11:51 AM
re : Finding the datas and deleting datas which are not found. ddiicc Excel Programming 7 August 30th 05 01:27 PM
validating datas from an excel LauraIv Excel Programming 0 May 9th 04 05:16 PM


All times are GMT +1. The time now is 11:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"