I have a small group of excel files that I've tried to code to update a master file. I have borrowed code snippets and adapted the rest (still trying to learn). My appologies to those I borrowed from! I would give you full credit if I could remember who did what. Anyway, The files are on a network share folder and everything works perfectly for me, but when one of the people who this was disigned for tries to update it always says "File already open, please try again later." This message is built in to the code.
All the files are in the same shared folder (to make it easier for me) along with the master file.
Here is the code:
Private Sub CommandButton1_Click()
Const strMaster As String = "PMT_Master.xls"
Dim wbMaster As Workbook
Dim srcrng As Range
Dim destrng As Range
I did a macro on my mac to transfer a sheet from one workbook to another worbook. It works very well when the destination workbook is open. Therefore I wanted to add some piece of code to check if the destination workbook is open. If not then I wanted the macro to open it before tranfering the sheet. Here is the code I´m using for tranfering the sheet
Sub Transfer_Sluttet() If ActiveSheet.Index <> Sheets.Count Then Application.DisplayAlerts = False Set ws = ActiveSheet Sheets(ws.Index + 1).Delete ws.Move Before:=Workbooks("Sluttet.xls").Sheets("sheet2") 'Moves active sheet to beginning of named workbook. 'Replace Test.xls with the full name of the target workbook you want. Application.DisplayAlerts = True End If End Sub
This is the type of macro I useually use on my pc to check if a workbook is open and if not then open it
If IsWorkbookOpened("Filename.xls", "C:Documents and ..................
I would like to write a Sub that will see if a workbook is open and if it is not then open it. I know how to have a macro automatically open a workbook, but I run into problems when the macro runs and tries to open an already opened workbook.
I have to files and a macro which copies data from one file to the other. The code goes as follows:
Sub test()
Range("A2").Activate
ActiveCell.Copy
ChDir "D:" Workbooks.Open Filename:="D: est2.xls"
Range("B1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False End Sub
Everything is ok as long as the second file (test2) - the one data is copied to, is closed the moment the macro starts acting. The problem is: when test2.xls was opened before the macro was activated a window pops up saying that all unsaved data in test2.xls would be lost.
The best thing to do is to write a piece of code stating that : if the target file is closed then the macro should open it and do its stuff, but if the target file is already opened than the macro should simply switch to the already opened workbook without trying to reopen it. All I need is a piece of code regulating that
Y have files that are stored as .xla files because they are standalone applications that just contain the code.
Y need to test if one .xla file is open and if so close it, so i'am able to open another one. Otherwise the APP withevents from both APP get all mixed up.
I'am actually doing it from vb.net 2005 and i 'am using latebinding. But the code would be similar y guess.
how to check if a workbook is open or not, and then do something on the resualt. What I would like to know is, how can I make the program check if the file is open on another on the server where others can access it? I'm reading this back, not sure im explaining it right... If i have a macro that checks if a file is open, is it checking if its open on just my PC, or is it checking if its open else where?
This is the function Roy did for me: [code].........
I have some code setup to create hyperlinks to all the excel files relevant to the current project a user is working on - it details when each file was last modified so it's possible to see how the project is progressing - and whether or not they need to review any changes.
I could do with including a flag detailing if someone else currently has the file open (prior to them attempting to open the file - as they're more than likely to open as read only and end up saving under a new filename - which I don't want happening) - as many of the projects are shared (one user might be in Edinburgh, the other in London for Example). It would be handy to display the user's excel User Name (as I've persuaded everyone to update this). I've added messageboxes identifying Last modified by user x , dd/mm/yyyy hr:min to auto_open's in the past, but am experiencing brain-freeze today
Private Sub Workbook_Open() Dim vFileName As String Dim sLastSaveTime As String Dim sLastAuthor As String vFileName = ThisWorkbook.Name Application.Volatile sLastSaveTime = _ ThisWorkbook.BuiltinDocumentProperties("Last Save Time") Application.Volatile sLastAuthor = _ ThisWorkbook.BuiltinDocumentProperties("Last Author")................
I am looking to check if its open, if it is, then copy the row, if not, then close it.
I am still new to vb, so learning as I go, but looked at many other posts, and there are so many ways i have seen to open one, I'm not sure which is the best, and none that I have seen show me if they check if its open.
My company used Excel with VBA as a sales tool. We recently updated to new application all together. The sales force, being familiar with Excel and most of them finding it much easier is still giving old pricing quotes based on some of the built in product forms and calculating tools from the Excel files. I want them to still be able to view the excel files they made in order to see old customer data and projects they built but I needed to disable all the features so they can’t save as just build another quote using the tool
I've locked down a copy of the tool how I want it locked down but now I need to figure out a way that anytime excel is opened by anyone in the domain; I need to check if certain criteria exists on that workbook (Sheet1. Name = “xxx” And Sheet21.Name = “zzz”) etc. f it meets the criteria I need to import my revised modules (module1 and module3) and form (frmsplash) over the existing copies of the modules and form. If not I need to allow the intended workbook to open as intended. They employees initially got the document by downloading it under the same name, but have since saved the document as many other names.
I am just wondering if there is a way of checking if the workbook that is currently open is the only one that is open, as I have been asked to make my code exit the application if this is the case rather that just close that one file.
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....
I have created a spreadsheet some time ago and have been asked to improve on it but I'm rusty with VBA.
I have an automated ordering system that saves each sent order as the date e.g "05-04-2013.xls" but the management team want a graph with the data for the last 4 weeks compared. I have created a seperate workbook called "consumables report.xls" which has a column with the products listed followed by columns "Quantity" and "cost" which is repeated for the 4 weeks of the month.
I want to add a button to prompt the user to choose the saved order e.g "05-04-2013.xls" (all orders saved in same directory) to copy and paste the quantity and cost columns (c8,D69) into "consumables report.xls". I got this to work earlier but it would only paste the formulas and not the values. So I need
A prompt to open workbook Copy range (c8,d69) Close work sheet Paste special .value (c8,D69)
I dont care if it has to open the workbook to copy the data as this will only be used once a month so it dosnt matter how slow the code is.
I have two workbooks. One is a no-nonsense form interface that my bosses will use to enter safety information. I'll call this workbook "Form". This file is stored locally on each of their computers. The other workbook is stored on a common drive. I'll call it "Master".
When my bosses fill out the Form and click "Submit", the Master file is opened, and certain cells are populated based on information entered in the Form. This is the code I am using to make this happen:
I have Monthly sales sheets that import my cash register data into them. I wanted to set them up to do everything without being there. So I have my task manager open excel at 9:30pm everyday and it runs the macro to import the data into the correct day of the month. Here is the workbook
open macro-
Private Sub Workbook_Open() Dim dTime As Date dTime = Time If dTime >= TimeValue("9:30 PM") And _ dTime < TimeValue("9:40 PM") Then ImportData End If End Sub
This is in my July spreadsheet only. So is there a way to make it know which month spreadsheet to open on the 1st of the month? So come August 1st it will automatically open the August workbook and input the data for the first day? By using the date?
I have a presentation that I open from a short-cut. After the "Welcome Page" is opened, I want to open a second workbook in a new instance of Excel after 4 seconds.
I think that I can open the new instance of excel, but I don't know how to activate the macro after 4 seconds.
I'm sure there is a function someplace for this that can be used in a macro.
Then, after the second Workbook is opened, I want the Welcome Page "Workbook" closed, leaving the second Worbook open.
My Splash screen opens a few seconds after the workbook has loaded. Is there a way to make the workbook open minimzed until the the splash screen closes then open properly? What I trying to say is that only the splash screen is visible until it closes.
Create a full copy of an open workbook (eg. activeworkbook MyFile.xls) using VBA, with the new copy (eg Book1.xls) open as well ,without having to save a copy first then open it ?
I want to create something like this: macro checking if file aaa.csv isn't open, if it is macro should stop and show message box "Close aaa.csv", and if file isn't open it should continue to work.
The file aaa.csv is stored in the same folder as workbook with my macro.
I need VBA code to check if two spreadsheets are open at the same time. One is named OMD.xls and the other Report.xls
If they are not, then I need the current sub-routine to stop and exit, followed by a message box that informs the user to open the two spreadsheets at the same time.
know a simple code that I can use in Excel VBA to simply check if Microsoft Word is open or not? I'm not worried about checking for a specific document, but just if the application is running or not.
I have written a VBA code to make a pivot table from data in another workbook,A, and transfer it to workbook B. I however dont want to restrict this code to workbook A only. This is because usually workbook A will have varying names everytime it is sent. I want to be able to get data from any other workbook that is open at the same time as work book B. What code can I use to select/activate another unspecified open workbook and get data from there?
I have a spreadsheet with (to keep it simple) with three fields: Name, Date, Complete.
When the spreadsheet opens I'd like a macro to run to check each row of data, and if the Date is before or on today's date and the Complete field is empty, a message box should appear to alert the user with the Name and row number.