VBA - Open File NOT In Read Only Mode
Nov 27, 2011
I have a VBA script that has been running fine for months on one computer. Today, I ran it on another computer and it opened files in read only mode which disrupted everything.
The file open command is the following:
Workbooks.Open Filename:=sourcePath & sourceFileName
I searched the entire project and appended ", readonly:=false" to every open command. So, the command became
Workbooks.Open Filename:=sourcePath & sourceFileName, readonly:=false
Still, Excel opened the file in read only mode as seen in the title bar (filename [read-only]).
If I double-clicked on the file and opened it, it's NOT in read only mode. I checked the property of the file. It is NOT read only.
View 2 Replies
ADVERTISEMENT
Jun 7, 2013
I have a file is used by many person at the same time. Sometime 2 person can open it as compatible mode , when 2nd person save will write over the 1st person data, that means all have been done by 1st person will be gone, serious problem.
Normally open a file will tell me who have using it , but it show wrongly person although the person has not open the file. worse that 1 day only show 1 person name.
View 4 Replies
View Related
Jan 16, 2010
1. Check if file is already open
a) If Not then Open the File
b) If It is Open then Show Message That File is Open And Will Load Once the user close it.
2. Check When the file is Closed And Open it
View 3 Replies
View Related
Oct 7, 2008
I have a workbook set up with hidden worksheets available only with a password. What I would like to do is set this up so that those employees who have the password will have full rights to make changes, while those who don't have the password will have "read only" rights. It should always open as a "read only" file, and then change to full rights when you enter the correct password.
I've also set this up so that it cannot be printed; can I also set it up so that it cannot be saved anywhere on our local drive?
I have the macro set up to limit the access via a password, but don't know where or how to set up these other changes.
View 9 Replies
View Related
Jan 31, 2014
I have a excel file that opens and will automatically run a bunch of tasks if a certain user opens it. This user is only used to automatically run this excel file, other users need to open the file occasionally to edit emails address, add clients etc stuff like that, that the automation part of it works off.
Currently I have this user running the file every hour using Win7 Task Scheduler. This is working well, except for the time when another user is editing the file on the hour and of course the Automated user gets the "this file is open blah blah blah, open as read only, cancel etc" popup, this stalls everything, and if I dont notice it, it could sit like this for days.
The file runs in Read Only fine, so... Basically my question is, how to open this file as "Read Only" using Task Scheduler? As if it just ran as Read Only all the time then it wouldnt matter what other users were editing at any given time.
One of my ideas was to have Task Scheduler run a VBS script instead of running the Excel file directly, and having the VBS script simply load the Excel as Read Only.
View 5 Replies
View Related
Jan 11, 2007
I have a read only excel file which I want to interrogate in another report.
I'm writing some code to open the file but I'm not sure how to get past the password/read-only prompt when opening the file.
My code is:
Workbooks.Open Filename:= "C:Sales2006.xls"
I assume it's possible to write some code to get past the prompt. I have checked the help files which do seem to indicate it's possible to specify a read only property but it doesn't say how.
View 5 Replies
View Related
Aug 12, 2009
I understand that vba can determine if the current file is read-only using the following to return true / false. GetAttr(ThisWorkbook.Path) And vbReadOnly
which seems to work fine for determining if the file is read-only, as there is another instance of the file already open. However when opening a file straight from a zipped directory (i.e. not extracting the file first), Excel opens the file as read-only. The above code returns false in this instance, i guess because the workbook path has a .zip ending rather than the normal .xls etc endings. how to return true that the zip file is read-only?
View 2 Replies
View Related
May 31, 2013
I've got a spreadsheet that has password protection before you can "modify" it. All of a sudden today, when I open the spreadsheet and enter the correct password, it still opens but only as Read Only.
View 3 Replies
View Related
Apr 9, 2008
Is there a way to remove the option to open a file as read only when the file is already open by another user? Ideally when a user tries to open a file that is already in use they would get a message to that effect and the only option at that point would be for them to select "notify" when file is available.
View 8 Replies
View Related
Jan 4, 2007
I'm trying to open a file on a network drive...but I'm getting the following error message when it opens: "This file may be read-only, or you may be trying to access a read-only location. Or the server the document is stored on may not be responding." Now, the file itself has no rights restrictions and is not read only. It doesn't appear to be locked.
Now, there are other Excel files in the same directory which I could open fine; however, the Excel documents having the above problem all have a little black icon "appears to be a padlock" (image attached) at the bottom left hand side of the Excel file icon. I tried the following:
- Renaming
- Converting to a different file format (didn't work, it won't let me)
- Opening in notepad...etc doesn't work.
This file is dated back in 2004...do you think it's corrupt? Is there anything i can do to open or recover this?
View 2 Replies
View Related
Oct 6, 2006
I have a .txt file created in Notepad and it contains a 4 digit number (Job ID). I am recieving the dreaded "Bad File Mode" (#54) error when writing back the file.
I would like to OPEN it as R/W locked, read it, increment it by 1 and write it back. Am perfectly willing to create the .txt as non-binary if that is causing the issue.
Dim jinChar As String
fileNumber = FreeFile()
jinFP = "JIN.txt"
Open jinFP For Binary Access Read Write Lock Read Write As #fileNumber
Input #fileNumber, jinChar
jobIDNumber = CInt(jinChar)
jobIDNumber = jobIDNumber + 1
jinChar = CStr(jobIDNumber)
Write #1, jinChar
Close #fileNumber
View 4 Replies
View Related
Feb 12, 2014
I already have a couple of VBA commands on my sheet. so I've tried to add:
[Code] .....
but this isnt making the sheet automatically go full screen.
View 2 Replies
View Related
May 25, 2014
How can I get a excel document to automatically open in full screen mode, and is it possible to lock it in this view?
View 2 Replies
View Related
Jul 23, 2004
I like a particular workbook to open in full screen mode.
How would I do that?
View 9 Replies
View Related
Sep 3, 2013
I'm using Excel 2010. I have a workbook with only 1 worksheet in it and it will be sent to several people. I want that excel file to open in Full View when the end user opens it. Is this possible without any VBA codes?
View 2 Replies
View Related
Jan 12, 2013
I am running a call centre with 20 users at peak time. I have 1 user who will always have a master workbook open and saving throughout the day. The remainder of the users during calls will need to open this file as read-only to simply view the latest saved version.
This works however sometimes is takes a over a minute for the file to download from the server for the read only box to appear. I was wondering if there was a way for the other users to view it in a simpler and quicker way?
Also issues with the 1 user saving the file which others have it open as read only?
View 11 Replies
View Related
Jun 16, 2014
I have a file that's only instruction is to open another workbook in Read Only; this is due to not having network privileges to make the entire folder Read Only.
I'm getting one user on the network where the Workbook.Open script doesn't fire up automatically and I can't see why. Then ocassionally i'm getting users where the file hasn't closed itself after the file has been opened.
Is there any obvious reason for both of these happening?
Code:
Application.ScreenUpdating = False
Workbooks.Open FileName:=ThisWorkbook.Path & "iSS.xls", ReadOnly:=True
Application.ScreenUpdating = True
ThisWorkbook.Close False
View 1 Replies
View Related
Jan 3, 2013
I have written a macro to loop through files and subfolders to open a specific file for a specific month. I extract the datasets for every excel file into a master template. The code works flawlessly when all of the files have the .xlsm extension. However, I need to open .xls file formats also. When my code opens the first .xls file, named "Staffing Plan.xls" it opens it and automatically makes it "Staffing Plan1 [Compatibility Mode]. I can't open the file in the original "Staffing Plan.xls" file format to read data from. How can I fix this?
View 3 Replies
View Related
Jan 21, 2009
below code
Sub Collect_OS_Data()
With Application
.ScreenUpdating = False
.EnableEvents = False
End With
Dim fso As Object, fld As Object, fil As Object, fldPath As String, wbSrc As Workbook, wbCur As Workbook
fldPath = "Q:PublicPAYMENTS Q&RREPORTSSuspense Activity BUSINESSOngoing - Suspense BUSINESS - Activity Reports"
Set wbCur = ActiveWorkbook
ActiveSheet.Name = "Raw Data"
Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.getfolder(fldPath)
On Error GoTo ErrHandler
For Each fil In fld.Files
This opens all spreadsheets within a folder and takes the data i require out of each one and pastes to a new workbook, however the files are password protected. Can you add into the code to open each spreadsheet as a readonly copy and paste data and then close without a save prompt or denying the save prompt ?
View 9 Replies
View Related
May 31, 2013
I have a tool file which contains Excel VBA codes. When I click button it asks to select a file. I want that anytime I click the button the dialogue box should open in the folder containg the tool.,
View 1 Replies
View Related
Apr 12, 2013
A client has sent me an Excel workbook that appears on the screen with the message adivising that it is Protected View as a result of having been downloaded from the internet. If I click on the Enable Editing button the workbook is completely deactivated. I have played around with my Trust Centre settings but nothing seems to work.
View 1 Replies
View Related
Sep 14, 2012
I used to read *.txt file into C/C++ program?
Now from Yahoo downloading stock prices, they are in EXCEL *.csv format. How can read them into C/C++ program?
View 5 Replies
View Related
Apr 10, 2007
Is that possible that I can make an excel file as a read only through code... and if needed should be opened by giving password ?
View 6 Replies
View Related
Jan 5, 2005
I know how to pull an entire text file
into an Excel Spreadsheet, but I only want specific information from
the text file not the entire text file.
What I have is about 25 text files stored in a folder, let's say
C: est.
Each file is named by a property address as follows:
209 MAIN ST.txt
213 MAIN ST.txt
111 ELM ST.txt
2356 WOOD AVE.txt
On the 11th row of each file is as follows:
Property Address:209 MAIN ST
On the 31st row of each file is as follows:
Total Value:30500
What I would like to do is read each file located in the "C: est
folder and write a record (row) into a single Excel Spreadsheet for
each property. I would like the Excel Spreadsheet to look as follows
once completed. Note the 1st row below is a header row that needs to
be generated by the code.
Property AddressTotal Value
209 MAIN ST 30500
213 MAIN ST 60700
111 ELM ST 20400
2356 WOOD AVE 20900
Can I read a header list (in a spreadsheet, text file, or hard coded in
the code) which I would prefer the spreadsheet or text file method,
write the header row in A1 then B1. Next read the 25 text files and
search based on the header info written above (Property Address & Total
Value) and write the appropriate to the single spreadsheet. The 11th
row of the First text file value written in cell A2, then read the 31st
row of the First text file write the value in cell B2, then loop to the
Second text file and values from The 11th row of the Second text file
value written in cell A3, then read the 31st row of the Second text
file write the value in cell B3, so on and so forth until the last text
file is read and the last record is written.
View 14 Replies
View Related
Aug 21, 2009
I have attached three excel files .....In the file called 'sampleBook1latest' I have a button called 'click here to clear a schedule' If I click that button and choose OR,start time and duration of a surgery then a schedule that is already created wil get cleared.....I have the total number of nurses and number of nurses used saved to the side of the sheet..... The total number of nurses at the side is read from another excel file called 'Input file for # of nurses'
Now the problem is that if clear a schedule then the number of nurses used is not getting updated at the side.....if I clear a schedule then the number of nurses at the side should also get updated....for example(If I create a schedule with 3 nurses and if only a total of 3 nurses are available then..... the used number of nurses for that specific time at the side will get updated to 3 from 0 and if I clear that schedule then the used nurses for that time should again become 0)....
The other problem is that if I schedule a surgery then all details of the surgery will be saved in another excel sheet called 'input file for patient details' so if I clear a schedule then all the details of that surgery saved in that excel sheet should also be cleared......
View 11 Replies
View Related
Oct 30, 2012
I am trying to use code in a VBA macro to change my file to a read-only file at the end of the macro after I've done a few other things to the file. I'm using this line of code:
ActiveWorkbook.ChangeFileAccess xlReadOnly
This code does in fact change the file to read-only. After the macro finishes I see "Read-Only" in the title of the file. However, when I close the file and re-open it the file is no longer read only.
I've tried changing the code to this:
ActiveWorkbook.ChangeFileAccess xlReadOnly
ActiveWorkbook.Save
But that doesn't work because it tells me I can't save the file after it's been converted to read-only.
View 1 Replies
View Related
Aug 30, 2007
I need to make a workbook read only depending upon certain conditions that are apparent only on start up. As I cannot assign the ReadOnly property, is my only solution to trap the Save command and dissallow "save changes".
View 9 Replies
View Related
Apr 9, 2014
I have written a little test sub which reads the contents of a binary file, which is approximately 0.2 Mb in size, into a byte array.
My sub is as follows:
[Code]...
It works just fine, BUT, it is incredibly slow (it spends 80 seconds in the For loop!!!!!)
How can I speed this up?
Note that the binary file can be of arbitrary size.
I tried using a string buffer filled with zeros, and it works!
View 1 Replies
View Related
Feb 25, 2009
I have written a VBA to read data from a text file (almost 5 MB = 2 lakh rows) and write into excel file. The script runs fine and transfers all data to the excel.But when i open the resulting excel file, only the first 2 and the last worksheets are visible. The worksheets in between and the data in it are missing. Second issue is tht, although i have written code to create a new worksheet when row number reaches 65535, the script writes only till row no. 32768.
View 2 Replies
View Related
May 21, 2014
I've a word form that collects free text and tick boxes. I'm reading these into separate rows on an excel sheets. So far what works...
I've got excel vba converting the word to a delimited text file
I've got excel vba to remove the erroneous rtns that people have entered into the free text that was things up.
In the free text there are commas entered as well as the tick boxes and this is a csv. Example
"how do I do this, I don't know",1,1,0,1,"really seems to be a challenge!"
If I just use excel to open the text file then the columns work out ok and on a single row - I think the 'text qualifier' is playing a role here.
But I can't replicate this in VBA. If I record a macro it's a query table and I don't know how to amend the code to read into rows.
View 2 Replies
View Related