Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-06-2025, 10:38 AM
TE-Events TE-Events is offline VBA Code anpassen von Windows auf Mac (Customize VBA code from Windows to Mac) Mac OS X VBA Code anpassen von Windows auf Mac (Customize VBA code from Windows to Mac) Office 2016 for Mac
Novice
VBA Code anpassen von Windows auf Mac (Customize VBA code from Windows to Mac)
 
Join Date: Oct 2025
Posts: 1
TE-Events is on a distinguished road
Default VBA Code anpassen von Windows auf Mac (Customize VBA code from Windows to Mac)

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
Wenn Ihr weitere Angaben benötigt einfach Fragen.
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
Reply With Quote
  #2  
Old 10-07-2025, 02:49 AM
p45cal's Avatar
p45cal p45cal is offline VBA Code anpassen von Windows auf Mac (Customize VBA code from Windows to Mac) Windows 10 VBA Code anpassen von Windows auf Mac (Customize VBA code from Windows to Mac) Office 2021
Expert
 
Join Date: Apr 2014
Posts: 956
p45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond reputep45cal has a reputation beyond repute
Default

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
Reply With Quote
Reply



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
VBA Code anpassen von Windows auf Mac (Customize VBA code from Windows to Mac) 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
VBA Code anpassen von Windows auf Mac (Customize VBA code from Windows to Mac) Scan and edit doc in windows using Office 2000 on Windows 8 karenhaas Word 3 01-29-2014 12:23 PM
VBA Code anpassen von Windows auf Mac (Customize VBA code from Windows to Mac) Does the Office 2013 interface look different in Windows 7 vs Windows 8? tamijsmith Office 2 12-17-2013 01:55 PM
VBA Code anpassen von Windows auf Mac (Customize VBA code from Windows to Mac) Macro works in Windows XP but not in Windows 7 Baldeagle Word VBA 3 09-30-2013 03:56 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:37 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft