![]() |
|
|||||||
|
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Hallo zusammen,
ich habe folgenden VBA Code um eine Ablage in Excel einzulesen. Leier klappt dieser nicht aus einer MAC Umgebung, und ich komme da auch nicht genau dahinter warum nicht. Könntet Ihr mir dazu bitte Hilfe leisten. Der Speicherort liegt auf einem NAS und ist per WEBDAV eingebunden. Translation: Hello everyone, I have the following VBA code to read a sheet in Excel. But this does not work from a MAC environment, and I can't exactly figure out why not. Could you please help me with this. The storage location is located on a NAS and is integrated via WEBDAV. HTML Code:
Sub DatenHolen_neu()
Dim i As Long, lngZ As Long
Dim strCurPath As String
Dim strNewPath As String
Dim varDateien As Variant
Dim wsZiel As Worksheet
strCurPath = CurDir
strNewPath = "X:\02_Berichtwesen\Berichte_aktuell\Berichte 2025"
ChDrive strNewPath
ChDir strNewPath
varDateien = Application.GetOpenFilename("Excel Files (*.xls*), *.xls*", , , , True)
ChDrive strCurPath
ChDir strCurPath
If IsArray(varDateien) Then
' Wenn das Makro in der Zieldatei steht, kann die Datei ThisWorkbook genannt werden.
Set wsZiel = ThisWorkbook.Sheets("Alle_Einsätze")
lngZ = wsZiel.Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To UBound(varDateien)
With Workbooks.Open(varDateien(i), , True).Worksheets("Bericht1")
' Cells wird wie folgt verwendet Cells(Zeilennummer, Spaltennummer)
' Die erste Zahl in der Klammer zeigt die Zeile, die zweite die Spalte
wsZiel.Cells(lngZ + i, 1) = .Cells(5, 45)
wsZiel.Cells(lngZ + i, 2) = .Cells(5, 36)
wsZiel.Cells(lngZ + i, 3) = .Cells(27, 34)
wsZiel.Cells(lngZ + i, 4) = .Cells(12, 39)
wsZiel.Cells(lngZ + i, 6) = .Cells(12, 44)
wsZiel.Cells(lngZ + i, 7) = .Cells(17, 44)
wsZiel.Cells(lngZ + i, 9) = .Cells(30, 20)
wsZiel.Cells(lngZ + i, 10) = .Cells(56, 12)
wsZiel.Cells(lngZ + i, 11) = .Cells(56, 14)
wsZiel.Cells(lngZ + i, 12) = .Cells(56, 16)
wsZiel.Cells(lngZ + i, 13) = .Cells(57, 12)
wsZiel.Cells(lngZ + i, 14) = .Cells(10, 7)
wsZiel.Cells(lngZ + i, 15) = .Cells(10, 35)
' Datei schließen, ohne Änderungen zu speichern
.Parent.Close False
End With
Next i
End If
End Sub
Liebe Grüße und vielen Dank Translation: If you need more information, just ask. Best regards and thank you Thomas Last edited by macropod; 10-06-2025 at 03:40 PM. Reason: Added English translation |
|
#2
|
||||
|
||||
|
I suspect .GetOpenFilename is the problem.
See: How can I make 'GetOpenFilename' to work on a Mac? - Microsoft Q&A Select files | Mac Excel Automation Programmatically Selecting Files in Excel for Windows and Excel for the Mac | Microsoft Learn |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Windows 10 Professional vs Windows 10 Home S | yjsk2100 | Windows | 0 | 04-15-2021 07:29 AM |
Convert Ofc 2000/Windows XP OS docs to Windows 7 OS which has NO Ofc Version Loaded
|
mylittleturbott | Office | 2 | 03-17-2014 03:18 PM |
Scan and edit doc in windows using Office 2000 on Windows 8
|
karenhaas | Word | 3 | 01-29-2014 12:23 PM |
Does the Office 2013 interface look different in Windows 7 vs Windows 8?
|
tamijsmith | Office | 2 | 12-17-2013 01:55 PM |
Macro works in Windows XP but not in Windows 7
|
Baldeagle | Word VBA | 3 | 09-30-2013 03:56 AM |