ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   DIM Variant / String (https://www.excelbanter.com/excel-programming/369850-dim-variant-string.html)

Helmut

DIM Variant / String
 
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\MESSERmmy y",
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 ", _
"This is the Subject line"
.Close False
End With
Kill Fname
Application.ScreenUpdating = True


End Sub


All times are GMT +1. The time now is 11:24 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com