Auto_Open Macro and Dropbox

Zunit

New Member
Joined
Feb 14, 2013
Messages
32
Hi,

I have some files saved in a Dropbox folder that is shared between two people. I want to set up an excel file on the dropbox to open another excel file when I open the first one.

But how to I do this using a macro? Below is the macro I use currently, but the problem is the user name in the link. When the other user opens the file the dropbox link is different.

Macro is below:

Code:
Sub Auto_Open()
'
'
    Workbooks.Open Filename:="C:\Users\User1\Dropbox\Fm Services\BMS\[BMS.xlsx]"
    ThisWorkbook.Activate
    
    
End Sub

The problem is User1. When User2 opens the file on his computer (via Dropbox) the macro doesn't work since it doesn't find the link.

Is there a way of linking the 'User1' part of the above to the name of the User of the computer that the file is on? Or some other way of getting around this?

Thanks for the asssitance.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
only thing I can think of is maybe an input box? depends how many users there are. if theres only two you wouldn't need an input box but if its a department of 50 then it would probably be easier.

try the below anyway. untested.

Code:
Sub Auto_Open()
mybox= inputbox  ("What is the user name?")

Workbooks.Open Filename:="C:\Users\" & mybox & "\Dropbox\Fm Services\BMS\[BMS.xlsx]"
    ThisWorkbook.Activate
    
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,116
Messages
6,128,931
Members
449,480
Latest member
yesitisasport

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