I am new to using VBA in Access. I was wondering what steps I need to take so that I can perform the following after a macro that I have already built completes. In other words, I need to do this as the final step after the Access Macro completes:
1. Open a particular txt file.
2. Insert text at the end of the first cell in the file
3. Save and close the file.
I have already created this step in Excel and the VBA is shown below. I am hoping I can simply paste this into a location in Access so that the macro in Access and that final step can all occur in a single step.
Thanks for any direction you can provide.
Here is the VBA from Excel:
Sub HalfTest2()
'
' HalfTest2 Macro
'
'
Workbooks.OpenText FileName:= _
"C:\Users\Tim\OpenDrive\Access DB Exports\007_HalfFileAV2.txt", _
Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), _
Array(2, 1), Array(3, 2), Array(4, 2), Array(5, 2), Array(6, 1), Array(7, 1)), _
TrailingMinusNumbers:=True
ActiveCell.FormulaR1C1 = _
"Action (SiteID=US|Country=US|Currency=USD|ListingType=Hal f|Location=US|ListingDuration=GTC)"
Range("A2").Select
ActiveWorkbook.Save
ActiveWindow.Close
Workbooks.OpenText FileName:= _
"C:\Users\Tim\OpenDrive\Access DB Exports\007_HalfFileAV2.txt", _
Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 1), _
Array(2, 1), Array(3, 2), Array(4, 2), Array(5, 2), Array(6, 1), Array(7, 1)), _
TrailingMinusNumbers:=True
ActiveCell.FormulaR1C1 = _
"Action (SiteID=US|Country=US|Currency=USD|ListingType=Hal f|Location=US|ListingDuration=GTC)"
Range("A2").Select
ActiveWorkbook.Save
ActiveWorkbook.Save
ActiveWindow.Close
End Sub