Hello
I wonna print an existing excel file.
But i have always an error with my code
"Code:
Dim wb1 As Excel.Workbook
wb1.Workbook.Open("C:\Brandstoffen Van denbrande-VanRoie\Mazoutprijs-ingevuld.xls")
DirectCast(wb1.Sheets(1), Excel.Worksheet). _
PrintOut(From:=1, To:=1, Copies:=1, Preview:=False)
Why doesn't work this
Or have somebody an better idea to print a excel file

Print an excel file
bslim
Additional information: C:\Brandstoffen Van denbrande-VanRoie\Mazoutprijs-ingevuld.xls kan niet worden gevonden. Controleer de spelling van de naam en de locatie van het bestand.
Als u het bestand opent in de lijst met laatst geopende bestanden (menu Bestand), controleert u of de naam van het bestand is gewijzigd en of het bestand is verplaatst of verwijderd.
I have this error :s
This line is yellow
wb1 = app.Workbooks.Open("C:\Brandstoffen Van denbrande-VanRoie\Mazoutprijs-ingevuld.xls")
racka4279
Ghehehe... glad you could be helped
-= Maarten =-
jerv_it
The error is fairly easy, saying that it could not find the document you try to open. So I guess you have either misspelled the name or the path of the document you try to open or it has difficulties finding the path.
I would recommend that you do some macro stuff to check to see that the document is opened. Open Excel and create a macro:
Sub Test()
Workbooks.Open Filename:="C:\Brandstoffen Van denbrande-VanRoie\Mazoutprijs-ingevuld.xls"
End Sub
I checked this, created the directories and file, and worked without problems here. If it does not work with your environment you better check the filename.
-= Maarten =-
PRSDeveloper
C:\Brandstoffen Van denbrande-VanRoie\Mazoutprijs-ingevuld.xls
must be
C:\Brandstoffen Van den brande-Van Roie\Mazoutprijs-ingevuld.xls
with some space more
CMR12963
Hello, just created a small sample:
Dim wb1 As Excel.Workbook Dim app As Excel.Applicationapp =
New Excel.Applicationwb1 = app.Workbooks.Open(
"C:\Brandstoffen Van denbrande-VanRoie\Mazoutprijs-ingevuld.xls") DirectCast(wb1.Sheets(1), Excel.Worksheet). _PrintOut(From:=1, To:=1, Copies:=1, Preview:=
False)Within VSTO:
Dim wb1 As Excel.Workbookwb1 =
Me.Application.Workbooks.Open("C:\Brandstoffen Van denbrande-VanRoie\Mazoutprijs-ingevuld.xls") DirectCast(wb1.Sheets(1), Excel.Worksheet). _PrintOut(From:=1, To:=1, Copies:=1, Preview:=
False)hope this helps,
greets, Helmut
[http://www.x4u.de]
KyleLewis