Prevent Workbook Being Left Open Stopping Others Accessing

Feb 20, 2008

I have a spreadsheet on an intranet drive, and many people need to see it and enter information. Sometimes, we have the file opened on a computer, and the user walks away, and their station is locked. That prevents anyone from updating or using the file! locate a macro that will count how long the file is inactive, and then quit?
I'm not at all comfortable coding in VBA, and this sort of thing is out of my range!

View 4 Replies


ADVERTISEMENT

Excel 2010 :: Accessing VBA Module From UserForm On Workbook Open

Feb 13, 2013

I am using Excel 2010 and late binding to generate reports. The sheets are blank and unused. I have the UserForm being opened on Workbook_Open and the actual VBA for doing the work in a separate macro in the workbook. All the posts I have found are dealing with accessing cells from the UserForm and I haven't found any dealing with connecting a macro to the UserForm output.

My question is this: I want to return from the UserForm the flags of which reports to run to the (unopened) macro containing the code to do so. How do I open the macro and pass the variables to it?

The UserForm is creatively called "SelectionForm" and the macro is called "DailyFTP" with a Main sub as the entry. I know I can use the code under to capture the radio button and checkbox choices. I have other variables like the names of files set as global variables in the DailyFTP macro. The macro doesn't exist until SelectionForm opens it, so they must be set after the macro is in memory.

View 6 Replies View Related

Prevent Workbook Opening If Other Workbook Open & VBE

Aug 29, 2006

how to prevent a workbook from opening if another excel document is open and if a visual basic window is opened.

View 8 Replies View Related

Prevent Closing Of One Workbook When Two Are Open

Sep 23, 2009

I'm trying to prevent a user from closing a perticular workbook.

Here is some important factors.

Workbook(A) = "LA-01-04-10" This is only one of 52 other but only one is open at a time.

Workbook(B) = "LA.xls" Always the same name and is always opened when one of the workbooks(A) above it opened.


When workbook (A) is opened it will then open another workbook (B) at that time the window is hidden workbook(B) So the user can only see workbook (A) I have a button on workbook(A) that unhides the window to show workbook(B) After the user completes his work in Workbook (B) they need to click another button that sorts the list and returns them to workbook(A) (Which also hides the window for workbook(B).

The problem is I have users that are trying to close workbook(B) instead of pressing the sort list button. So what I want is to prevent the user from closing workbook(B) by displaying a msgbox saying they need to press the button.

Ive tried several approches to this but I'm still having problems. The below script works if workbook(B) is active or shown. The message is displayed and the workbook will not close. However if the user is in workbook (A) and trys to close the message is displayed and both workbooks close like they are suppose to. But why is the message displayed?

One other note I should say is that not only does workbook(A)Open workbook (B) but it also closes it. Which may be why I'm having problems?

I have also included both workbooks so you can see all the code.

I have this code in Thisworkbook of workbook(B)

View 10 Replies View Related

Prevent Calculations Upon Workbook Open

Jan 16, 2007

I have this code in my ThisWorkbook module:

Private Sub Workbook_Open()
With Application
.Calculation = xlManual
End With
End Sub
I want it to open the workbook without going through calculations (which take a long time)...

It sets to Manual, but still re-calcs upon opening...

View 9 Replies View Related

Prevent User From Accessing The Excel File When It Is In Use By Another User

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

Accessing Data From Other Workbook

Jan 17, 2008

How can i access data from other workbook i have opened.?
I am new in VBA.So little code snippet would be good to show.
I want to get the cell data from workbook2 to workbook1

View 9 Replies View Related

Accessing UserForm In WorkBook (A) From WorkBook (B)

Jan 2, 2013

there is no direct method to access the Properties/Methods of a remote userform and its controls at runtime..... I needed this in a small project recently and I thought I would post here the solution I came up with as this may prove useful to others.

1- Code in the UserForm Module in Workbook A (Server workbook)

Code:
Option Explicit
Private Declare Function SetProp Lib "user32" Alias "SetPropA" _
(ByVal hwnd As Long, ByVal lpString As String, ByVal hData As Long) As Long
Private Declare Function RemoveProp Lib "user32" Alias "RemovePropA" _
(ByVal hwnd As Long, ByVal lpString As String) As Long

[code]....

This also works for more than one loaded userform.

View 1 Replies View Related

Prompt Open Closed Workbook Then Copy Range And Paste Special Into Open Workbook

Apr 6, 2013

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.

week 1 week 2 week 3 week 4
Product
quantity
cost
quantity
cost
cost
quantity
cost

1
2
3
4
5
6
7
8

View 7 Replies View Related

Always Open To Top Left Corner

Sep 26, 2008

Trying to get spreadsheet to always open to top left corner. Though this works, a few spreadsheets will take forever to close if I make any changes and save changes to the spreadsheet

View 3 Replies View Related

Make Workbook Open- Open Correct Month Workbook

Jul 8, 2006

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?

View 9 Replies View Related

Prevent The User From Saving The Data Input From The User Form If Any Of Those Three Fields Is Left Blank

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

Prevent Links Updating On Open

Oct 8, 2007

I have a large workbook 45MB with 40 sheets each containing a section that links to the server to update itself when the workbook calculates. With that being said it's impossible to have the workbook on Automatic calculate because the update process can take about 7-10 minutes so its set to manual. However, I would like to prevent the links from updating (its one link that is used to update the file) by possibly a macro that runs when the workbook opens and prevent the update link from running when I press F9 to manually calculate.

View 2 Replies View Related

Prevent Event Code Running When Other Workbooks Open

Aug 23, 2008

I am having difficulties with my Worksheet_Activate() macro. It works great within workbook1 when it is only workbook1 open - but when I open another workbook2, the macro stills runs, presumably because Sheet1 of workbook1 is still activated as well as the newly activated sheet in workbook2.

Is there a way to ensure that only 1 worksheet of 1 workbook is activated at a time? Or that sheet1 of workbook1 is deactivated when workbook2 is opened/clicked on? I need my Worksheet_Deactivate macro to run to get rid of my Worksheet_Activate macro (which runs an application that resets the function of keyboards keys). Otherwise moving around workbook2 is a nightmare. When I navigate back to workbook1 while workbook2 is still open, I still want sheet1 of workbook1 to be activated and my macro to run .

View 7 Replies View Related

Automatically Open New Workbook After 1st Workbook Open 4 Seconds

Nov 6, 2009

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.

View 14 Replies View Related

The Workbook Open Minimzed Until The The Splash Screen Closes Then Open Properly

Nov 20, 2008

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.

View 5 Replies View Related

Check If Workbook Is Open & Open If Not Open

Jul 1, 2007

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.

View 5 Replies View Related

Prevent To Only Save On Specified Workbook With VBA

Jan 28, 2013

am trying to create a workbook template which collects data from users with user forms and some macros. Users assign a project name when workbook opens and then they are able to save as the workbook with name of project name. But i don't want them to save on my template mistakenly. How do i prevent this? I tried workbook_before close sub but i can manage that it recommends to save workbook with project name and if you don't want, it still asks you if you want to save workbook before close

View 7 Replies View Related

Prevent Workbook Being Closed

Apr 2, 2009

I display a message box in Workbook before Close event.
If user click yes I shouldnt close the workbook if NO i should close the workbook.

In the Yes part, How can I stop excel from closing the workbook.
If i dont write any ocde it automatically closes in the event.

View 2 Replies View Related

Prevent Saving A Workbook

Jul 5, 2006

I'm wondering if it is possible to prevent a user saving a workbook. If opened as a read-only, excel throws up an option to save with an alternative name. I'm wondering if I can put some code in the Workbook_BeforeSave event that prevents saving of the document unless the application.username is myself.

View 2 Replies View Related

Prevent Any Workbook Theft Through VBA

Jun 4, 2007

I want to prevent any Excel Workbook Theft through VBA

1. check the existence of any file in Windows directory ( which we do put for this security)

2. If it doesnt exist "pireted copy? close!" error message may apear

I know it is not fool proof. but it can gives 40% protection

View 5 Replies View Related

Prevent Closing Of Workbook By Top Right X

Nov 20, 2007

I need to alter the Close command on the title bar (the 'X' on the top right corner on the blue bar of excel)

Is there any way to alter the close button on the title bar to have it call a sub I created instead of actually closing excel?

View 6 Replies View Related

Force Re-Open Of Open Workbook With No Confirmation

Jun 11, 2009

this is a relatively straightforward query, would be obliged for any tips on same. I have the following piece of -

View 2 Replies View Related

Create Open Copy Of Open Workbook

Jul 30, 2009

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 ?

View 9 Replies View Related

MacRO: Check If WorkBook Open. If Not, Open It.

Sep 27, 2006

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 ..................

View 3 Replies View Related

Prevent A User From Opening Another Workbook

Feb 12, 2009

How can I prevent a user from opening another workbook in an Excel session "from the outside"?

I'm fairly new to VB. I'm developing (in VB 2003) a simple but SECURE Excel environment which will allow a user to update a hidden Master_Records workbook. I need to keep the user's Excel session secure...for example, I've disabled all Excel Toolbars and Command Buttons, effectively preventing the user from doing anything except filling in some cell values and clicking on a few custom buttons in the worksheet. But how can I prevent the user from opening another workbook into the active session from his desktop and introducing some malicious code into the session via that route?

One respondent in another forum (the only one, in fact) suggested that I look into "instantiating workbook level events" so that I can detect when other workbooks are open. I'm not sure what that means, is there someone here who could give me some guidance into that solution?

View 13 Replies View Related

Prevent Workbook Protection In VB Code

Dec 1, 2011

I have a workbook that contains macros. When the workbook is protected, the macro returns an error so I have unprotected the workbook but, if someone protects the workbook and saves it, it returns an error when closing and even if they choose cancel, it still screws up the macro and prevents it from working upon reopen.

Is there a way to prevent someone from protecting the workbook in vb code?

View 7 Replies View Related

Prevent/Stop Workbook Closing Via Top X

Aug 30, 2006

i am using the following code to close my userform and work book,this disables the exit button on the userform but i can still close the workbook by using the exit buttons on the sheet. can i disable the exit buttons on the sheet so the only way to close the workbook from the userform

Private Sub CmbClose_Click()

Dim ans As Variant
ans = MsgBox("This will close XL, save current file?", vbYesNoCancel)
If ans = vbYes Then 'save book and quit XL
ThisWorkbook.Save
Application.Quit
ElseIf ans = vbNo Then ' no save and quit XL
Application.Quit
ElseIf ans = vbCancel Then 'no save, no close , back to userform1
Exit Sub
End If

End Sub

View 7 Replies View Related

Prevent Workbook Save But Allow SaveAs

Jun 24, 2008

I've got a workbook that I want to keep intact in a central location on our local network, to make it easier for everybody to access, but don't want people to be able to save changes to the master workbook itself. I'd like to be able to disable the 'Save' feature while still allowing 'SaveAs'. The following code (installed in ThisWorkbook) results in the OPPOSITE of what I'm trying to accomplish (i.e., it allows 'Save' but disables 'SaveAs'):

Private Sub Workbook_BeforeSave(ByVal SaveUI As Boolean, Cancel As Boolean)

If SaveUI Then
MsgBox "The 'Save' function for this workbook has " & Chr(10) & "been disabled. Please use 'Save As'.", vbOKOnly + vbInformation, "Save Disabled"
Cancel = True
End If

End Sub

Obviously I'd also like to check the filename they're performing the 'SaveAs' under and disallow it if it matches the master filename.

I've thought about making the workbook into a template, which would sort of accomplish the same thing, but it would be much easier to just keep it as a workbook.

View 9 Replies View Related

Workbook Open Event :: If Workbook Is Already Open?

May 29, 2008

I have an Excel application in which I use the Workbook Open event to show a userform.

This works fine when Excel is not already open, but if another Excel workbook is already open, the Workbook Open event does not work.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved