Sub
Dateimitnamenspeichern()
Dim
pfad
As
String
, datei
As
String
, blatt
As
String
, bezug
As
String
, KW
As
Variant
pfad =
"S:\PRJ\FZG\Kompetenz_Team\08_Exterieur\09_BR-?bergreifend\00_Projektstatusberichte\DTK_Status\01_Statusberichte_DES"
datei =
"Status ?bersichtstabelle.xlsx"
blatt =
"copy paste Tabellen"
bezug =
"D3"
KW = GetValue(pfad, datei, blatt, bezug)
End
Sub
Private
Function
GetValue(path, file, sheet, ref)
Dim
arg
As
String
If
Right(path, 1) <>
"\" Then path = path & "
\"
If
Dir(path & file) =
""
Then
GetValue =
"File Not Found"
Exit
Function
End
If
arg =
"'"
& path &
"["
& file &
"]"
& sheet &
"'!"
& _
Range(ref).Range(
"A1"
).Address(, , xlR1C1)
GetValue = ExecuteExcel4Macro(arg)
End
Function