powered by simpleCommunicator - 2.0.49     © 2025 Programmizd 02
Форумы / XML, XSL, XPath, XQuery [игнор отключен] [закрыт для гостей] / открыть xml в excel
1 сообщений из 1, страница 1 из 1
открыть xml в excel
    #38288764
Dubosh
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Гость
Добрый день!
Имеется файл xml и шаблон xslt. В файле xml присутствует строка <?xml-stylesheet type="text/xsl" href="04.06.13.xsl"?>, соответственно при открытии xml в excel все отрабатывается и файл открывается.
Требуется открыть xml в excel без использования этой строки.
Сделала кнопку в exel, на которую повесила код:


Sub Select_File_Or_Files_Windows()
Dim SaveDriveDir As String
Dim MyPath As String
Dim Fname As Variant
Dim N As Long
Dim FnameInLoop As String
Dim mybook As Workbook

' Save the current directory.
SaveDriveDir = CurDir

' Set the path to the folder that you want to open.
MyPath = Application.DefaultFilePath

' You can also use a fixed path.
'MyPath = "C:\Users\Ron de Bruin\Test"

' Change drive/directory to MyPath.
ChDrive MyPath
ChDir MyPath

' Open GetOpenFilename with the file filters.
Fname = Application.GetOpenFilename( _
FileFilter:="XML Files (*.xml), *.xml", _
Title:="Select a file or files", _
MultiSelect:=True)

' Perform some action with the files you selected.
If IsArray(Fname) Then
With Application
.ScreenUpdating = False
.EnableEvents = False
End With

For N = LBound(Fname) To UBound(Fname)

' Get only the file name and test to see if it is open.
FnameInLoop = Right(Fname(N), Len(Fname(N)) - InStrRev(Fname(N), Application.PathSeparator, , 1))
If bIsBookOpen(FnameInLoop) = False Then

Set mybook = Nothing
On Error Resume Next
Set mybook = Workbooks.Open(Fname(N))
On Error GoTo 0

If Not mybook Is Nothing Then
MsgBox "You opened this file : " & Fname(N) & vbNewLine & _
"And after you press OK, it will be closed" & vbNewLine & _
"without saving. You can replace this line with your own code."
mybook.Close SaveChanges:=False
End If
Else
MsgBox "We skipped this file : " & Fname(N) & " because it is already open."
End If
Next N
With Application
.ScreenUpdating = True
.EnableEvents = True
End With
End If

' Change drive/directory back to SaveDriveDir.
ChDrive SaveDriveDir
ChDir SaveDriveDir
End Sub


Но этого не достаточно, нужно же еще наложить шаблон xslt...
Подозреваю, что это можно сделать при помощи библиотеки MSXML2, но ума не приложу как.
Заранее спасибо!
...
Рейтинг: 0 / 0
1 сообщений из 1, страница 1 из 1
Форумы / XML, XSL, XPath, XQuery [игнор отключен] [закрыт для гостей] / открыть xml в excel
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]