First module will be called mImportExport with folloowing procedures:
Sub ImportCSVFile()
Already I have presented a few ways how to import files with various extension as well in Excel as in Access environment.
Sub SaveReportAS()
I will choose one of following two possibilities:
Sub SaveMethod1()
Dim FilePath As Office.FileDialog
Dim Answer As VbMsgBoxResult
Dim FileName As String
‘open csv file and read it name
Set FilePath = Application.FileDialog(msoFileDialogSaveAs)
With FilePath
.InitialFileName = ThisWorkbook.Path
.AllowMultiSelect = False
.Title = “Save current worksheet as: “
If .Show = True Then
ActiveWorkbook.Save
ThisWorkbook.SaveCopyAs “C:\Users\Agnieszka\Desktop\PROJECT\Offer” & FileRec & “.txt”
End If
End With
End Sub
Sub SaveMethod2()
Dim s As Variant
s = Application.GetSaveAsFilename(InitialFileName:=ThisWorkbook.Path, _
fileFilter:=“Excel Files (*.xlsm), *.xlsm”, Title:=“Save current file: “)
If s <> False Then
ActiveWorkbook.Save
ThisWorkbook.SaveCopyAs “C:\Users\Agnieszka\Desktop\PROJECT\Offer” & FileRec & “.txt”
End If
End Sub
Some functions, like special file mark:
Public Function FileRec() As String
FileRec = Format(Now, “_yyyy-mm-dd_hh-mm-ss”) & “_fileauthor_” & Application.UserName
End Function
See whole code here: mImportExport
Second module gonna be about operations we would like to do in Excel after source data implementation.
Also I would like to have a botton in my project, with which I could restore data before described above operations (tax & total sale).
Sample of these codes you can see by openinig this file with module:
c.d.n…