vba check if file exists

#include <iostream>
#include <fstream>
#include <string>
using namespace std;

bool fileExists(const string& filename) {
  ifstream file(filename);
  return file.good();
}

int main() {
  string filename = "example.txt";
  if (fileExists(filename)) {
    cout << "File exists";
  } else {
    cout << "File does not exist";
  }
  return 0;
}