RichardAtk
asked on
VB macro works in Excel 2010 but not in Excel 2016
Excel / Macro VB
Have this code it works fine on Excel 2010 (opens runs saves and closes) upgraded to Excel 2016 and it opens runs and closes but leaves a save dialogue behind which is annoying as it's a scheduled job. Not sure what I need to add on the newer version of Excel.
Sub Macro1()
'
' Macro1 Macro
'
'Refresh Jet
Application.Run "JetReports.xlam!JetMenu", "Refresh"
Application.DisplayAlerts = False
Columns("C:F").Select
Range("C3").Activate
Sheets("Sheet3").Select
Columns("A:A").ColumnWidth = 4.14
Rows("1:1").RowHeight = 25.5
Range("A1").Select
ActiveCell.FormulaR1C1 = " "
Range("A1").Select
Sheets("Report").Select
Columns("C:F").Select
Range("C3").Activate
Selection.Copy
Sheets("Sheet3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("1:2").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Sheets("Report").Select
ActiveWindow.SelectedSheet s.Delete
ActiveWorkbook.SaveAs Filename:="G:\IT\Trimit\El astic\Feed s\Rab\inve ntory.csv" , _
FileFormat:=xlCSVMSDOS, CreateBackup:=False
ActiveWindow.WindowState = xlMinimized
Application.Quit
End Sub
Have this code it works fine on Excel 2010 (opens runs saves and closes) upgraded to Excel 2016 and it opens runs and closes but leaves a save dialogue behind which is annoying as it's a scheduled job. Not sure what I need to add on the newer version of Excel.
Sub Macro1()
'
' Macro1 Macro
'
'Refresh Jet
Application.Run "JetReports.xlam!JetMenu",
Application.DisplayAlerts = False
Columns("C:F").Select
Range("C3").Activate
Sheets("Sheet3").Select
Columns("A:A").ColumnWidth
Rows("1:1").RowHeight = 25.5
Range("A1").Select
ActiveCell.FormulaR1C1 = " "
Range("A1").Select
Sheets("Report").Select
Columns("C:F").Select
Range("C3").Activate
Selection.Copy
Sheets("Sheet3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Rows("1:2").Select
Application.CutCopyMode = False
Selection.Delete Shift:=xlUp
Sheets("Report").Select
ActiveWindow.SelectedSheet
ActiveWorkbook.SaveAs Filename:="G:\IT\Trimit\El
FileFormat:=xlCSVMSDOS, CreateBackup:=False
ActiveWindow.WindowState = xlMinimized
Application.Quit
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Application.DisplayAlerts = False
this command line will ignore dialog box from pops-up
move up
above the code
Application.Run "JetReports.xlam!JetMenu",
this code line: Application.DisplayAlerts = False should be come first
this command line will ignore dialog box from pops-up
move up
above the code
Application.Run "JetReports.xlam!JetMenu",
this code line: Application.DisplayAlerts = False should be come first
Application.DisplayAlerts does not prevent all Alerts, e.g. the save alert. It makes no difference if it is before the line that calls the addin code.
ASKER
Hi
I pasted this onto the bottom of the VB and it worked no idea why Excel 2016 is different but this works thanks Richard
I pasted this onto the bottom of the VB and it worked no idea why Excel 2016 is different but this works thanks Richard
Open in new window
Are you sure that the addin is compatible.