I have a module in Access to format cells in an Excel spreadsheet.
Sub FormatData()
Workbooks.Open FileName:="C:\Users\john.doe\Documents\scripts\apps\allow\Weekly_Cash_Trending"
Workbooks("Weekly_Cash_Trending.xlsx").Activate
Columns("C:C").Select
Selection.NumberFormat = "$#,##0"
Range("A1").Select
ActiveWorkbook.SaveAs FileName:="C:\Users\john.doe\Documents\scripts\apps\allow\Weekly_Cash_Trending"
End Sub
It works, but it gives a pop up to confirm saving the file (obviously not what you want when trying to automate something).
When I change the code to use "Application.DisplayAlerts"
Sub FormatData()
Application.DisplayAlerts = False
Workbooks.Open FileName:="C:\Users\john.doe\Documents\scripts\apps\allow\Weekly_Cash_Trending"
Workbooks("Weekly_Cash_Trending.xlsx").Activate
Columns("C:C").Select
Selection.NumberFormat = "$#,##0"
Range("A1").Select
ActiveWorkbook.SaveAs FileName:="C:\Users\john.doe\Documents\scripts\apps\allow\Weekly_Cash_Trending"
Application.DisplayAlerts = True
End Sub
I get the following error: Method or Data Member not found
I am new to VBA coding (obviously), can anyone help me resolve this? Thanks!
Sub FormatData()
Workbooks.Open FileName:="C:\Users\john.doe\Documents\scripts\apps\allow\Weekly_Cash_Trending"
Workbooks("Weekly_Cash_Trending.xlsx").Activate
Columns("C:C").Select
Selection.NumberFormat = "$#,##0"
Range("A1").Select
ActiveWorkbook.SaveAs FileName:="C:\Users\john.doe\Documents\scripts\apps\allow\Weekly_Cash_Trending"
End Sub
It works, but it gives a pop up to confirm saving the file (obviously not what you want when trying to automate something).
When I change the code to use "Application.DisplayAlerts"
Sub FormatData()
Application.DisplayAlerts = False
Workbooks.Open FileName:="C:\Users\john.doe\Documents\scripts\apps\allow\Weekly_Cash_Trending"
Workbooks("Weekly_Cash_Trending.xlsx").Activate
Columns("C:C").Select
Selection.NumberFormat = "$#,##0"
Range("A1").Select
ActiveWorkbook.SaveAs FileName:="C:\Users\john.doe\Documents\scripts\apps\allow\Weekly_Cash_Trending"
Application.DisplayAlerts = True
End Sub
I get the following error: Method or Data Member not found
I am new to VBA coding (obviously), can anyone help me resolve this? Thanks!