Word Document Properties


Part III: Expanding Your VBA Horizons



Download 8,82 Mb.
Pdf ko'rish
bet203/207
Sana16.03.2022
Hajmi8,82 Mb.
#496217
1   ...   199   200   201   202   203   204   205   206   207
Bog'liq
VBA For Dummies 5th Ed.pdf ( PDFDrive )

Part III: Expanding Your VBA Horizons 
17_046500 ch11.qxp 12/5/06 5:37 PM Page 246


proper form before exporting. When using the 
Export
method, you must
supply a string, and you should tell the method to overwrite any existing file
of the same name.
Importing the data from disk
Importing data from disk varies in difficulty based on the kind of XML file that
you want to import. Excel normally does a good job of figuring out how to
import well-formed XML. Listing 11-3 shows the code that you need to import
a standard XML file.
Listing 11-3
Importing XML from Disk
Public Sub ImportInventory()
‘ Obtain the XML from disk using the XmlImport.
ThisWorkbook.XmlImport “ExcelXML2.XML”, _
True, _
Sheet2.Range(“A1”)
End Sub
The 
XmlImport
method requires three arguments. The first is the name of the
file that you want to import. The second indicates whether you want to over-
write any existing data. Finally, you must supply a location to hold the data.
When you run this program, you see an Error in Schema dialog box. The data
exported with the example doesn’t include an XSD reference. Excel doesn’t
know how to interpret the data because it has no data definition. In this case,
you can safely click the Infer button to get the correct result.
Creating a Simple Word XML Document
Word automates the process of linking an XSD file to your document by
adding this feature through the document templates. When you create a doc-
ument by using a properly designed template, the XML tags are automatically
added according to the XSD schema that you create.
You might want to create searchable letters. One way to do this is to export
the letters as XML and to use a standard search engine. Start by creating a
letter template file. The example includes the usual features, such as To and
From addresses, the date that the letter was written, a greeting, the letter
body, and a closing element. Listing 11-4 shows the XSD file used to describe
this document. (You can find the source code for this example on the
Dummies.com site at 
http://www.dummies.com/go/vbafd5e
.)
247

Download 8,82 Mb.

Do'stlaringiz bilan baham:
1   ...   199   200   201   202   203   204   205   206   207




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish