Suppress macros start up folder possible?

dispelthemyth

Well-known Member
Joined
Mar 16, 2006
Messages
664
Office Version
  1. 365
Platform
  1. Windows
In the advanced Excel option you can select a folder which will have all files open when You 1st open Excel.
The problem is I have some vba that opens up new instances of Excel (intentionally) but each instance of Excel will try to open these files too but as they are open they get a read only message.
Is it possible to to suppress this folder, startup or to access the option via Vba so I can set it to be nothing before I open a file and revert it to the original option afterwards.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Something like this?
VBA Code:
    Dim oXLapp as Application
    Dim sOldPath as String
    ' prevent opening workbooks on startup
    sOldPath = Application.AltStartupPath
    Application.AltStartupPath = ""
    ' launch a separate instance
    Set oXLapp = New Application
    oXLapp.Visible = True
    Application.AltStartupPath = sOldPath
    ' rest of your code ....
 
Upvote 0
Another option would be to modify the code that opens the workbook to first check if they are already open.
Then the first time that code runs it will open the files but subsequent times it will not try.
 
Upvote 0
Another option would be to modify the code that opens the workbook to first check if they are already open.
Then the first time that code runs it will open the files but subsequent times it will not try.
Such an elegant and simple thing to do, thanks for the advice. I’m embarrassed I didn’t think of this.
 
Upvote 0
Something like this?
VBA Code:
    Dim oXLapp as Application
    Dim sOldPath as String
    ' prevent opening workbooks on startup
    sOldPath = Application.AltStartupPath
    Application.AltStartupPath = ""
    ' launch a separate instance
    Set oXLapp = New Application
    oXLapp.Visible = True
    Application.AltStartupPath = sOldPath
    ' rest of your code ....
Thank you for taking the time to post this code. This solution is great, I checked through the Application directory and didn’t see that option. I’ll check twice next time.
 
Upvote 0

Forum statistics

Threads
1,214,942
Messages
6,122,367
Members
449,080
Latest member
Armadillos

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