Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

VBA-Script->Was ist hier falsch???HILFE

Empfohlene Antworten

Veröffentlicht

If (Mid(objFile.Name, 1, 7)) = "CITOTBL" Then

If (FileExists("\\JVKRAXON\CEDS$\FILES\CITOTBL.TXT")) Then

DeleteFile "\\JVKRAXON\CEDS$\FILES\CITOTBL.TXT"

End If

objFile.Copy "\\JVKRAXON\CEDS$\"

objFile.Name = "CITOTBL.TXT"

objFile.Copy "\\JVGRIZZLY\CEDS$\FILES\"

objFile.Name = "CITOTBL.TXT"

objFile.Move "\\JVKRAXON\TRANSFER\NEW\"

End If

so, der compiler meckert wegen FileExists...warum?

Der sagt: type mismatch

Hmmmm du hast aber nicht das ganze Script gepostet.

In Welcher Application hast das Script denn drin?

(Waer vielleicht auch hilfreich, das zu wissen)

....und wieso sollte da eigentlich n Compiler meckern ? :)

Goos

1. VBA ist eine reine Interpretersprache. Es gibt keinen Compiler im herkömmlichen Sinn, da die Kommandos erst zur Laufzeit ausgewertet werden.

2. Das was du meinst ist bestimmt die automatische Syntaxprüfung. Die erkennt wie der Name schon sagt nur Syntaxfehlern.

3. Mir ist nicht bekannt, dass es in VBA eine FileExists-Funktion existiert. (Habe aber leider gerade kein Office da, um zu nachzuschauen)

4. Möglich wäre auch, dass keine UNC-Pfade unterstützt werden, dann würde aber eine andere Fehlermeldung kommen.

---

Zur Lösung des Problems:

a) Prüfen, ob eine Funktion namens FileExists für VBA exisitert (-->Objektkatalog). Es kann sein, dass es eine für das Scripting.FileSystemObject gibt. Dann muss dieses auch korrekt angegeben werden. [ fsObj.FileExists(...) ]

B) Parameter der Funktion prüfen

c) Funktion im Testfenster ausführen


? FileExists("\\JVKRAXON\CEDS$\FILES\CITOTBL.TXT")) 

Hoffe das hilft weiter

Hi,

Olli Master hat recht, die Funktion FileExists kann nur in verbindung mit einem FilesystemObject überprüft werden

also fso.FileExists(filename)

Zumindest ist es in VBScript so.

Gruß, Tiana

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.