web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Refresh Excel and Save...
Power Automate
Unanswered

Refresh Excel and Save as a new file

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am trying to build a simple flow where, I need to open an excel file and then refresh the file (through Data tab); file is connected to a cube residing in Azure, then when the refresh is complete I want to save as a new file with date refreshed. I am new to Flow and could not locate built in templates to do so. Anyone could help me to point me in the right direction?

Categories:
  • Max44 Profile Picture
    223 on at

    Try these two VBA code snippets

    Text
    Sub wigi()
    
     With Workbooks.Open("C:\Path\Myfile.xlsm")
     .RefreshAll
     .Close True
     End With
    
    End Sub
    
    Private Sub SaveWorkbookAsNewFile(NewFileName As String)
     Dim ActSheet As Worksheet
     Dim ActBook As Workbook
     Dim CurrentFile As String
     Dim NewFileType As String
     Dim NewFile As String
     
     Application.ScreenUpdating = False ' Prevents screen refreshing.
    
     CurrentFile = ThisWorkbook.FullName
     
     NewFileType = "Excel Files 1997-2003 (*.xls), *.xls," & _
     "Excel Files 2007 (*.xlsx), *.xlsx," & _
     "All files (*.*), *.*"
     
     NewFile = Application.GetSaveAsFilename( _
     InitialFileName:=NewFileName, _
     fileFilter:=NewFileType)
     
     If NewFile <> "" And NewFile <> "False" Then
     ActiveWorkbook.SaveAs Filename:= NewFile, _
     FileFormat:=xlNormal, _
     Password:="", _
     WriteResPassword:="", _
     ReadOnlyRecommended:=False, _
     CreateBackup:=False
     
     Set ActBook = ActiveWorkbook
     Workbooks.Open CurrentFile
     ActBook.Close
     End If
     
     Application.ScreenUpdating = True
    End Sub


    Also, check out this option

    Data>Connections>Properties and uncheck the 'Enable background refresh' button. 

    And play with ScreenUpdating set to True and False to have it show

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 289

#2
11manish Profile Picture

11manish 288 Super User 2026 Season 2

#3
Henil Profile Picture

Henil 125

Last 30 days Overall leaderboard