Get User Name :: For File Used By Another User
May 13, 2004
how to get informazion with VBA code about the name of the user who opened already a workbook on the network.
Usually if somebody wants to open a file that is opened by another user, office applications give informations that the file is open and about the name who opened that file.
Is it possible to get this information with VBA code, too?
View 9 Replies
ADVERTISEMENT
Jul 11, 2012
I have an excel file with multiple sheets. I want my HR team to update that file, but one user shouldnt see the entries of other users. I want to make a consolidated file out of three files. This excel template is for salary input.
View 3 Replies
View Related
Jul 22, 2013
An Excel file named CLEARING is availble in thr central server system. it will be accessed by 5 or 6 staffs from some other systems what i need is when one person accesses/edits this file the others should not even able to open in the read only file ,when the file is saved and closed ,then only the next person should access it
View 1 Replies
View Related
Feb 9, 2010
I have a user form that has a combo box "City" two text boxes one called "Flight" and the other "Date". What I'm trying to do is to prevent the user from saving the data input from the user form if any of those three fields is left blank. The code that I have so far checks all of the required fields, if any are left blank a message notifys which field(s) is left blank and return the focus back to that field. But the rest of code also fires.
What I really need is either to stop the code if any fields are blank and return the focus back to the blank field, the user completes the field(s) and clicks the save again, or better yet, pause the code until all the required fields are completed and then complete the save. (There is actually another 200+ lines of code in this sub, but I deleted it to keep the post a little shorter.)
View 2 Replies
View Related
Jun 16, 2006
find attached zip file . if you open the file then you can understand the problem.
I need to change cells color and text color as per user choice in Password protected sheet : (user is useing excl2000)
Kindly open attahced file i putted the note inside the file.
View 3 Replies
View Related
Feb 17, 2010
I am trying to check a user input to see if the user has entered the date correctly. I am using the code below but it keeps giving me a "Type Mismatch" error.
View 2 Replies
View Related
Apr 2, 2009
I have a workbook that is used to track overtime hours worked through the year. I've received some help from users on this forum, and others, to create the necessary macros and formulas to allow a supervisor to make use of the form; however, the workbook is also used to track those that wish to volunteer to work overtime each weekend. The sheet has a list of names for the employees on each shift, then a column to allow a "Y" to be placed under the date - designating them as a volunteer for any overtime available. I've found this spreadsheet (attached - from this site) that will allow individual users to access the workbook and have unique passwords for each. I don't completely understand how it works, but I feel it may be a start to getting what I want.
Essentially, once the user selects their name and inputs their password, I'd like the workbook to be opened and then allow them to only manipulate the row associated with their name. That row will change from week to week, so specific numbers will not be able to be used, but their name will be the same as the name used in the logon.
I feel like I'm asking for a lot here, so just some initial guidance on whether this type of thing is possible would be an acceptable answer.
View 9 Replies
View Related
Jan 26, 2008
Below is the current code I have for File Copy before the workbook closes. This file will be distributed all over and obviously will not have the same old path and new path locations as I have in my code also will not have the same file name. Is there anyway to still perform the file copy without knowing the old path and file name and possibly have message box pop up to ask the copy to location and use that in the new path string?
Sub Macro1()
Dim fs As Object
Dim oldPath As String, newPath As String
oldPath = "I:EXLDATAMC Daily" '<---Where the file is currently located
newPath = "H:South RegionOrlando Mail Services2008DI" 'Since the super shared drive is super slow we will just copy and replace this file each time before we close and of course after we save
Set fs = CreateObject("Scripting.FileSystemObject")
fs.CopyFile oldPath & "" & "OrlandoMail.xls", newPath & "" & "OrlandoMail.xls"
Set fs = Nothing
End Sub
View 4 Replies
View Related
Dec 20, 2006
VBA code Identify which user has a particular file open. This file is on our shared drive and recently we've had people open the file and leave their desk. They haven't input an Excel username so frequently we cannot tell who has the file open to ask them to close it.
I'm trying to write a macro that will tell me if the file is open and if it's open, who has it open (using their computer login name).
View 9 Replies
View Related
Nov 23, 2006
I have written a sub to open a txt file, but I want to then save it as Excel, with a filename (a variable). The variable is public, and is set by other subs. I have added the standard "save as..." button to my custom toolbar to use for this and the following code (taken from previous thread)
Public Sub SaveFile(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI = True Then
Application.EnableEvents = False
Application.Dialogs(xlDialogSaveAs).Show MyVariable, FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False
Cancel = True
Application.EnableEvents = True
End If
End Sub
But it comes up with the original filename in the save as dialogue and txt file type. Any help would be great, this is used by inexperienced users and I don't want the original file saved as it's prevoius name and type
View 6 Replies
View Related
May 21, 2007
I Want make a code to open (OPEN File Dialog)
and it works good I can't change the Diroctory!
Sub OpenFile()
fileToOpen = Application. GetOpenFilename("Execl Files ( *.xls), *.xls")
ChDir "C:" ' Not work good
If fileToOpen <> False Then
Workbooks.Open Filename:=fileToOpen
Else
Exit Sub
End If
End Sub
check this code.
View 5 Replies
View Related
Sep 3, 2009
Does VBA support any type of "browse for file" interface? I'm thinking something similar to an inputbox, but instead it gives you the standard looking windows explorer window to find a file (think adding an attachment in outlook).
The function would return a string.
View 2 Replies
View Related
Oct 17, 2011
I am writing code that requires data from another workbook. Instead of hardcoding the directory and filename (which changes daily), how can I have the code prompt the user to do this for me?
I want to open the file with:
links updated
read-only
Also, is there a way to have an initial directory that appears so the user need not go through a dozen directories every time to get to the file?
View 3 Replies
View Related
Oct 18, 2011
I have code that prompts the user to open a specific excel file. However, with the following:
Filepath = "..."
name = Application.GetOpenFilename(FileFilter:="Excel Files *.xls* (*.xls*),",)
Workbooks.Open name
the default directory you start out in in the window that prompts the user to select a file is NOT ...
How can I properly assign which directory the user starts in so they need not go through 10 sub-directories everytime they run this code?
View 2 Replies
View Related
Nov 7, 2006
I want to do is prompt the user for an Excel file and then insert it as a new worksheet as sheet 2. Also, if possible I would like the imported file to insert to the right of sheet 1. Anyone know how to do this or at least know some parts of this problem.
View 9 Replies
View Related
Jul 10, 2006
I have a excel Product database and a Data Entry Userform. I can gte this to work fine but need to make some improvements to make it look professional.....here's what I am looking to do...:
1) When a user add a new product using the Data Entry form, I want the user to be able to add a hyperlink to the datasheet of that product and this hyperlink will then be saved in my database in column M of that product alongwith all other details in other columns. The DataSheet files are PDF files that are stored on the public drive. So I am hoping to use a browse function or similar to select the file to hyperlink to...
My current hyperlinks look like this which I have created manually directly into the column M (not through userform):
V:PublicCOMBData SheetsData SheetsXXXXX.pdf.............
View 3 Replies
View Related
Oct 19, 2006
We have several salespeople who maintain a workbook tracking their workflow. I want to compile the customer account number, account name and deal number for each rep to another workbook. A new sourcebook is started each week. This code is in the target book
'Option Explicit
Public sourcebook As Object 'the workflow workbook
Sub GETDATA()
Dim wsc As Double 'the number of pages in the workflow
Dim col As Long 'the column in this workbook for returning values
Dim IntEndRow As Double 'the end row in this book
Dim SrcEndRow As Double 'the end row in workflow
Dim findval 'the column workflow where the sourcedata is found
My code allows the user to select a workbook and then loops through each sheet in that book searching for the column which has the info I need, this changes on each sheet as the reps each deal with different types of customer as so take different details. I solved this by having column headers in the target book and searching for them in the sourcebook.
This code works when I step through it but falls over at the "Set sourcebook" line when I run it where it returns a breakpoint error.
View 3 Replies
View Related
Oct 20, 2006
how to alert and force second user to quit (i.e. even cannot open the file as "read-only) if the excel file is being opened by other?
View 3 Replies
View Related
May 1, 2007
I have an Excel VBA routine which opens another Excel file as a part of the routing. For example:
' Beginning of the code.
Workbooks.OpenText Filename:= Range("log_file").Value, Origin:=xlWindows
' Rest of the code.
The problem I run into is when the user does not have access (via Windows Active Directory) to the file located in the "log_file" range. They usually will get the old runtime error 1004. I can easily trap that error but err 1004 is used so many other times, I don't want to mistakenly trap it as something else. Does anyone know of a way to verify and/or check if the user has read/write access to a file (or folder) before opening it?
View 4 Replies
View Related
Jun 18, 2007
I want to open a user defined file name in excel and then activate it , to run a macro on it.
View 3 Replies
View Related
Aug 5, 2008
I am trying to refer to an open file in VBA script.
The script below is asking the user to open a file from which data is copied. I am trying to refer back to this open file but as the file name and path are not mentioned in the script, I am not able to.
myMsg = "Please Select Euromcontact Master DISTOPS File"
Response = MsgBox(myMsg, vbExclamation + vbOKOnly, myTitle)
sFileName = Application. GetOpenFilename
Workbooks.Open Filename:=sFileName
Sheets("CL value").Select
Sheets( Array("CL value", "CL Units", "CLC Value")).Select
Range("N12:N37,S12:Z37").Select
Selection.Copy
Windows("Euromcontact Value File TEMPLATE.xls").Activate
Sheets("CLvalueDIS").Select
Sheets(Array("CLvalueDIS", "CLUnitsDIS", "CLCvalueDIS")).Select
Range("R12").Select
Selection.PasteSpecial Paste:=xlValues
Sheets("CLvalueDIS").Select
Sheets(Array("CLvalueDIS", "CLUnitsDIS", "CLCvalueDIS")).Select
Range("R12:R37").Select
Selection.Copy
Range("N12").Select
Selection.PasteSpecial Paste:=xlValues
Range("R12:R37").Clear
Application.CutCopyMode = False
View 9 Replies
View Related
Jun 12, 2008
I have been tasked by the company I work for to come up with a simple to use interface that can be used by someone with little understanding of excel to set the autofilters to certain settings.
So here is what I have:
2 sheets (each with the same number of columns but different data which corresponds to good and no-good)
Each column has an autofilter but only two on each sheet need to be set.
One filter controls valve type (of which there are 10) and the other controls running condition (startup and normal)
Now my employer wants something that is basically idiot proof so that someone can simply open up the excel file, input the valve type and running condition, and be rewarded with only the corresponding data and charts. Now the filters are already in place, the charts already exist and the only thing left is the user interface.
View 14 Replies
View Related
Mar 11, 2008
I'm trying to write a macro that will bring up the "File Open" dialog box, and allow the user to navigate to the directory where the file is located. It won't be the same file every time, and the files will likely have different names.
View 14 Replies
View Related
Oct 23, 2008
The code below opens a window which allows the user to select a file to open. Apparently, it starts in the directory of the file containing the macro. How would I modify this to open in "M:Archived PO ResponsesProcessed"?
View 3 Replies
View Related
Feb 18, 2009
I have a cell that displays the user name and would like the cell to update whenever the file is opened and display the user. Below shows what the VBA module code. The cell has this formula "=Usrname()".
Function Usrname() As String
Usrname = Environ("username")
End Function
View 9 Replies
View Related
May 24, 2009
I have code (below) that works if the range "ImportFile2" contains a valid value but I want users to be able to select any .csv file preferably from a directory which should be held in a cell.
I added ...
View 9 Replies
View Related
Sep 23, 2009
I am trying to do an automated import, the file I'm importing comes out of an application and in its properties just shows "file" so I can't use the standard text file methods. I originally recorded a macro for the automation and have tried to amend it.
I think it is falling over in the Destination stage, or maybe I need something instead of where the ". Name =" would normally go?
Private Sub All Files()
Dim sFilename
sFilename = Application _
. GetOpenFilename("All Files (*.*), *.*")
If sFilename <> False Then
Sheets("Sheet2").Select
With ActiveSheet.QueryTables.Add(Connection:=sFilename _
, Destination:=Sheets("Sheet2").Range("A4"))
'.Name = "All Files"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
View 5 Replies
View Related
Jul 28, 2004
I have a program that opens an excel-workbook, I first check whether the file is opened by another user(open for read-write). This works fine, but I'd like to know which user has the file open with VBa code. ex.
workbooks.open ....
if open
then msgbox " Book opened by user"
end if
So it's the same as you open an excel(with your windows explorer) on a network and you get the message that the file is already opened by the user....
View 2 Replies
View Related
Feb 6, 2008
i try to write a code to pop up input box with browse button to select the file path
the code without browse button is workin corectly
Private Sub CommandButton3_Click()
Dim N As Integer
Dim Fname As String
Fname = InputBox("Please enter the file name and path to save the output", "enter file name")
Sheets( Array(Sheet2.Name, Sheet3.Name)).Copy
ActiveWorkbook.SaveAs Filename:=Fname
ActiveWorkbook.Close
End Sub
Need to add browse button to make it easier than writting the file path
View 4 Replies
View Related
Mar 9, 2008
i have this code to run autofilter in protected sheet2, assigned to a check Box,
but it gives me this Msg when i run the code by checking the check Box: File in use.
The file is locked for editing by the (my name). However, when i excute the code by F5 in the VBE window, it works fine also when i excute the code from Worksheet_Activate , it works fine
Sub t()
With Sheet2
. Protect "0", , , , userinterfaceonly:=True, Allowautofilter:=True
.AutoFilterMode = False
.Range("A5:DT5").AutoFilter
End With
End Sub
View 2 Replies
View Related