Irgendwann habe ich es richtig verstanden. Der Schlüssel sollte verwendet werden CreateDirectory()
, um den gesamten Verzeichnispfad einschließlich des Housing
Verzeichnisses am Ende der Hierarchie zu erstellen .
Dim sPath As String = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Housing") Dim Fpath As String = sPath & "\Stored Information.xlsx" IO.Directory.CreateDirectory(sPath) ' If location already exists it will not do anything If My.Computer.FileSystem.FileExists(Fpath) = False Then My.Computer.FileSystem.WriteAllBytes(Fpath, My.Resources.StoredInformation, True) ' Don't want to append data (although that would not happen in this instance) so True is used for that. End If Dim APP As New Excel.Application workbook = APP.Workbooks.Open(Fpath) worksheet = workbook.Worksheets("Sheet1") APP.Visible = False MessageBox.Show("File Opened!" & Environment.NewLine & "Path: " & Fpath)