DIM Variant / String

H

Helmut

Hi...I have the following MACRO where I save one WorkSheet as a *.CSV file
and then want to email it to one receipient.
I have a problem with the DIM Varient/String in order to keep the "Fname"
As it is, it emails a CSV-file but not with the Fname.
thanks - Helmut
------------------
Public Sub DoTheExport()
Dim Fname As Variant
Dim wb As Workbook

Fname = Application.GetSaveAsFilename("c:\MESSER\MESSERmmyy",
fileFilter:="CSV Files (*.csv), *.csv")

If Fname = False Then
MsgBox "You didn't select a file"
Exit Sub
End If

'Running the Public Sub below
ExportToTextFile CStr(Fname), ",", False

Application.ScreenUpdating = False
ActiveSheet.Copy
Set wb = ActiveWorkbook
With wb
.SendMail "(e-mail address removed)", _
"This is the Subject line"
.Close False
End With
Kill Fname
Application.ScreenUpdating = True


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top