Option Explicit Const MyFile = "d:\MyFile.xls" Const ForReading 1, ForWriting 2, ForAppending = 8 Const TristateUseDefault -2, TristateTrue -1, TristateFalse = 0 Dim objFso, objFile Set objFso = CreateObject("Scripting.FileSystemObject") On Error Resume Next Set objFile = objFso.OpenTextFile(MyFile, ForAppending, TristateFalse) If Err.Number <> 0 Then Msgbox "Le fichier est déjà ouvert"&vbCrLf& Err.Number &vbCrLf& _ Err.Source &vbCrLf& Err.Description : Err.Clear Else objFile.Close MsgBox "Le fichier n'est pas ouvert" Dim xlApp, xlBook, xlSheet Set xlApp = CreateObject("Excel.Application") Set xlBook = xlApp.WorkBooks.Open(MyFile) Set xlSheet = xlBook.Sheets("Feuil1") xlApp.DisplayAlerts = False xlApp.Application.Visible=True MsgBox "Le fichier " & MyFile & " est ouvert" xlApp.Quit Set xlSheet = Nothing Set xlApp = Nothing Set xlBook = Nothing End If Set objFile = Nothing Set objFso = Nothing
lui dire qu'il me l'affiche en plein écran
Set objFile = objFso.OpenTextFile(test1, ForAppending, TristateFalse)
If Err.Number <> 0 Then
?????????
Else
objFile.Close
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionOption Explicit 'On Error Resume Next Dim objExcel : Set objExcel = CreateObject("Excel.Application") objExcel.Visible = true objExcel.Workbooks.Open "c:\temp\test.xls"'à modifier objExcel.ActiveWindow.DisplayGridlines = False 'objExcel.Quit
set WshShell = createObject("WScript.shell") If "post-it.txt - Bloc-notes" = dans la barre des taches Then Selectionner "post-it.txt - Bloc-notes" Mettre "post-it.txt - Bloc-notes" au premier plan Else Wshshell.run "notepad.exe C:\post-it.txt"
Option Explicit Dim WshShell Set WshShell = wscript.CreateObject("WScript.Shell") WshShell.Run "Notepad.exe", 1, True
Option Explicit Dim WshShell, Str_Wegg, chemin Set WshShell = wscript.CreateObject("WScript.Shell") chemin = "C:\Windows" Str_Wegg = "cmd /c " & chemin & "Notepad.exe " & "chemin du fichier.txt" WshShell.Run Str_Wegg, 0, True Set WshShell = Nothing