|
открыть xml в excel
|
|||
---|---|---|---|
#18+
Добрый день! Имеется файл 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, но ума не приложу как. Заранее спасибо! ... |
|||
:
Нравится:
Не нравится:
|
|||
06.06.2013, 16:55 |
|
|
start [/forum/moderation_log.php?user_name=Noise+Hustler]: |
0ms |
get settings: |
11ms |
get forum list: |
14ms |
get settings: |
11ms |
get forum list: |
13ms |
check forum access: |
3ms |
check topic access: |
3ms |
track hit: |
43ms |
get topic data: |
14ms |
get forum data: |
3ms |
get page messages: |
30ms |
get tp. blocked users: |
1ms |
others: | 660ms |
total: | 806ms |
0 / 0 |