Auf Word 2003
Bei folgendem Programmcode habe ich das Problem, dass beim ersten Aufruf bzw. ersten Klick auf einen der Buttons der Pfad aufgerufen wird zum speichern, wo die Datei liegt. Jedoch habe ich ja vorgegeben, dass das Programm auf Laufwerk P:\ abspeichern soll.
Achja, wenn ich die Datei als *.dot aufrufe, will er die Datei auch als *.dot speichen, obwohl ich ja sag er soll als *.doc speichern. *verzweifel*
Bei folgendem Programmcode habe ich das Problem, dass beim ersten Aufruf bzw. ersten Klick auf einen der Buttons der Pfad aufgerufen wird zum speichern, wo die Datei liegt. Jedoch habe ich ja vorgegeben, dass das Programm auf Laufwerk P:\ abspeichern soll.
Achja, wenn ich die Datei als *.dot aufrufe, will er die Datei auch als *.dot speichen, obwohl ich ja sag er soll als *.doc speichern. *verzweifel*
Code:
Private Sub MailEDV_Click()
Call AktivesDokumentAlsAnhang_EDV
End Sub
Sub AktivesDokumentAlsAnhang_EDV()
Dim aws As String
Dim olapp As Object
Dim strPfad As String
strPfad = ActiveDocument.Path
ActiveDocument.SaveAs "P:\Dateiname.doc"
'MsgBox ActiveDocument.Path
ChDrive Left(strPfad, 1)
ChDir strPfad
With Dialogs(wdDialogFileSaveAs)
.Name = strPfad & "\" & ActiveDocument.Name
.Show
End With
ActiveDocument.Save
aws = ActiveDocument.FullName
Set olapp = CreateObject("Outlook.Application")
With olapp.CreateItem(0)
.To = "mail@adresse.de"
.Subject = "Mitteilung"
.ReadReceiptRequested = True
.Attachments.Add aws
.Display
End With
Set olapp = Nothing
End Sub
Private Sub MailPW_Click()
Call AktivesDokumentAlsAnhang_PW
End Sub
Sub AktivesDokumentAlsAnhang_PW()
Dim aws As String
Dim olapp As Object
Dim strPfad As String
strPfad = ActiveDocument.Path
ActiveDocument.SaveAs "P:\Dateiname.doc"
'MsgBox ActiveDocument.Path
ChDrive Left(strPfad, 1)
ChDir strPfad
With Dialogs(wdDialogFileSaveAs)
.Name = strPfad & "\" & ActiveDocument.Name
.Show
End With
ActiveDocument.Save
aws = ActiveDocument.FullName
Set olapp = CreateObject("Outlook.Application")
With olapp.CreateItem(0)
.To = "mail@adresse.de"
.Subject = "Mitteilung"
.ReadReceiptRequested = True
.Attachments.Add aws
.Display
End With
Set olapp = Nothing
End Sub