Error when file moved

bluewaterfree

New Member
Joined
Dec 6, 2020
Messages
20
Office Version
  1. 2019
Platform
  1. Windows
I searched and read numerous similar threads but haven't solved my issue.

Here's my situation...
Macro-enabled workbook titled "Budget2020v15.xlsb".
Created a customized ribbon with buttons on it to switch worksheets and automatically format. Here's one example..

Sub NextDiscover()
'
' NextDiscover Macro
'
' Set Screen Size Narrow Width and Full Height
Call ScreenSize(1280, 780, 0, 0)
' Activate Worksheet
Worksheets("Actual Income Expenses").Activate
' Set Column Widths
Call Set_Column_Width("A", 15)
Call Set_Column_Width("B", 15)
Call Set_Column_Width("C", 15)
Call Set_Column_Width("D", 15)
Call Set_Column_Width("E", 15)
Call Set_Column_Width("F", 15)
Call Set_Column_Width("G", 15)
Call Set_Column_Width("H", 15)
Call Set_Column_Width("I", 15)
Call Set_Column_Width("J", 37)
Call Set_Column_Width("K", 28)
Call Set_Column_Width("L", 0)
Call Set_Column_Width("M", 15)
Call Set_Column_Width("N", 11)
Call Set_Column_Width("O", 11)
Call Set_Column_Width("P", 37)
Call Set_Column_Width("Q", 11)
Call Set_Column_Width("R", 20)
Call Set_Column_Width("S", 14)
Call Set_Column_Width("T", 3)
'Set Row Heights
Rows("1:9999").RowHeight = 15
'Select Starting Upper Left Cell to View
ActiveWindow.Panes(1).Activate
Call Cell_Select("J", 1, True)
'Select Starting Cell to Edit
Dim NextBlankRow As Integer
ActiveWindow.Panes(4).Activate
NextBlankRow = WorksheetFunction.Match("BLANK", Range("M3070:M9999"), 0) + 3069
Call Cell_Select("N", NextBlankRow, True)

End Sub

Sub ScreenSize(Width As Integer, Height As Integer, Top As Integer, Left As Integer)
' Sets position and size of Excel Screen
Application.WindowState = xlNormal
Application.Width = Width
Application.Height = Height
Application.Top = Top
Application.Left = Left

End Sub

Sub Set_Column_Width(Row As String, Width As Integer)
Columns(Row & ":" & Row).Select
Selection.ColumnWidth = Width

End Sub

Sub Cell_Select(Column As String, Row As Integer, Scroll As Boolean)
Range(Column & Row).Select
Application.Goto Range(Column & Row), Scroll:=Scroll

End Sub


The workbook is stored in D:\Documents\Finances

Everything works fine.

On the same computer, I "Save As" to a different location.... example E:\ with the same file name. I then close Excel completely... even restart the computer. I then open the file from E:\. The file opens fine. When I hit the button associated NextDiscover, I get the error "Sorry, Excel can't open two workbooks with the same name at the same time."

It's on the same computer.... there's only one workbook open... I don't see anything trying to open a second workbook....

Help please!!
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Did you search here: C:\Users\username\AppData\Roaming\Microsoft\Excel\XLSTART
 
Upvote 0
Exactly where I looked.... I was surprised there wasn't a PERSONAL file there... the folder is empty.
 
Upvote 0
PERSONAL wouldn't have been a problem since it's used to preformat (customize) your sheet in a new file.
Sorry, no other Idea at the moment. I can't replicate the problem elsewise on my Excel.
 
Upvote 0
When you add buttons to the ribbon to run a macro, those buttons are linked to the workbook that held the code when the button was created.
So when you click the button Excel tries to open the original workbook.
 
Upvote 0
Solution
When you add buttons to the ribbon to run a macro, those buttons are linked to the workbook that held the code when the button was created.
So when you click the button Excel tries to open the original workbook.
Ok.... that rings a bell. I'll start researching how to resolve that.... so the button links update references when it's saved.... someone must have solved this in the past.

Thanks much
 
Upvote 0
The button link does not update, it always looks at the original workbook.
 
Upvote 0

Forum statistics

Threads
1,223,268
Messages
6,171,100
Members
452,379
Latest member
IainTru

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