Workbooks.Open in Excel 2016

LotusWaide123

New Member
Joined
Nov 16, 2017
Messages
3
[FONT=&quot]The following code works in older versions of Excel (I have about 3 different versions to work with), but in Excel 2016 it fails (or maybe it is failing on the specific computer... but I'm thinking it is the version of Excel). No error message… it just doesn’t do anything. It will work if I specify a file other than the currently open file, but it doesn’t work the way I intend (which is to open the same file currently active, thus overwriting any changes without saving in between - if someone has an alterantive way of doing that I'm all ears):[/FONT]
Code:
[COLOR=#555555][FONT=&quot]Sub ReOpenNoSave()[/FONT][/COLOR]
[COLOR=#555555][FONT=&quot]    Workbooks.Open ActiveWorkbook.Path & “\” & ActiveWorkbook.Name[/FONT][/COLOR]
[COLOR=#555555][FONT=&quot]End Sub
[COLOR=#222222][FONT=Verdana]
[/FONT][/COLOR][/FONT][/COLOR]
[FONT=&quot]FYI - The file is located in a normal folder on the PC and not in a network location (in case that would make a difference).

Any ideas? Thank you so much in advance![/FONT]
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Welcome to the Board!

VBA is very particular about things like quotes and double-quotes. It does not like slanted ones (your code caused an error on my computer).
This is what it needs to look like:
Code:
Sub ReOpenNoSave()
    Workbooks.Open ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
End Sub
 
Upvote 0
I think that may have been a copy/paste issue (I copied and pasted to Word first to check for spelling errors). I have standard quotes in my VBA workbook. Sorry about that! Still, same question exists =).
 
Upvote 0
Unfortunately, I am not on Excel 2016 here (I have it on my home computer, but not my work one). Maybe I will try it out tonight when I am at home.

if someone has an alterantive way of doing that I'm all ears
If what you are after is to simply re-open the file dropping all the changes you made in that session (assuming you haven't saved them), I have also just closed the file and then re-opened it by going to the Recent Files section of Excel and clicking on the top one.
 
Upvote 0
You are right. That doesn't seem to work in Excel 2016.

Here is an alternative. Instead of saving the macro to that particular workbook, save this macro to your Personal Macro Workbook (then the macros aren't tied to the workbook that is being closed, and can be run on any active workbook, and will always be available to you on your computer whenever you have Excel open). Here are the changes to that Macro:
Code:
Sub ReOpenNoSave()
    Dim fName As String
    fName = ActiveWorkbook.Path & "\" & ActiveWorkbook.Name
    ActiveWorkbook.Close False
    Workbooks.Open fName
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,196
Members
452,616
Latest member
intern444

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top