APRIRE FILE WORD E SALVARLO COME FILE TXT

16 views
Skip to first unread message

MINNIE

unread,
Dec 12, 2012, 9:35:43 AM12/12/12
to excel_v...@googlegroups.com
Ciao a tutti, avrei bisaogno del vostro aiuto
In un file excel ho inserito l'istruzione qui sotto che mi consente di aprire un file word (filetoopen) dopo averlo selezionato da una lista
Mi mancherebbe il passaggio successivo ossia salvare il file word come file testo
Qualcuno sa come poterlo fare?
ps anche se il file word una volta selezionato non c'e' bisogno di aprirlo va bene lo stesso
 
 
SUB APRIFILE()
filetoopen = Application.GetOpenFilename("DOC Files (*.DOC), *.DOC", , "Selezionare il percorso ed il file DOC ", "Apri", "False")
If filetoopen = False Then
Exit Sub
End If
On Error Resume Next
Dim X As Long
X = ShellExecute(0, "OPEN", filetoopen, "", "", 1)
End Sub

MINNIE

unread,
Dec 13, 2012, 5:53:16 AM12/13/12
to excel_v...@googlegroups.com
nessuno ha qualche idea

roberto mensa

unread,
Dec 13, 2012, 11:06:40 AM12/13/12
to excel_v...@googlegroups.com
Sub APRIFILE()
Dim filetoopen
Dim app
Dim doc

filetoopen = Application.GetOpenFilename("DOC Files (*.DOC), *.DOC", ,
"Selezionare il percorso ed il file DOC ", "Apri", "False")
If filetoopen = False Then
Exit Sub
End If

Set app = CreateObject("word.application")
Set doc = app.Documents.Open(filetoopen)
doc.SaveAs2 VBA.Left(filetoopen, InStr(Len(filetoopen) - 4,
filetoopen, ".") - 1) & ".txt", 2
app.Quit False
End Sub

saluti
r
Reply all
Reply to author
Forward
0 new messages