I have excel vba code to open .xls files on my server. Files to open are chosen by the user via a UserForm within my app, it shows them all their files in their directory on my server. How can I open their files (.xls) that they select but DISABLE the VBA from being able to run/execute, if they have any attched to the file?
I now have all code in place to open the file no problem, I just need to know how to disable the VBA part from being "turned on" when the file opens.
I run a macro which runs saves the active file to a different location to ensure that I retain the original like so -
If ActiveWorkbook. Name = "KEY_DATA_CFT77" + ".xls" Then ActiveWorkbook.SaveAs Filename:= _ "H:HOME imcEXCELKEY_DATA_2006KEY_DATA_2006_01KEY_DATA_CFT77_01.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _ , CreateBackup:=False End If .................................
the small code i'm writing just needs to do the following:
1. open an .xslx file selected by the user 2. copy 2 worksheets from that file to the current one 3. close the selected file without saving it.
This is my code:
VB: Sub GetData() MsgBox ("Please select a file"), vbOKOnly Master = Application.GetOpenFilename(FileFilter:="Excel Files (*.xlsx), *.xlsx", Title:="Please select a file")
Opening the file works, but the last 3 lines don't because i don't understand how to declare "Master": however i dim it (workbook, object, variant...) i get an error on the GetOpenFilename line. If i don't declare it, i get an error while trying to copy the worksheets.
The Macro asks the user to point at the location of a report, it then copies information out of that report and pastes it into a master sheet. The part I am having trouble with is closing the file that data has been copied from.
can group all opened file in 1 excel tab instead if many tabs? open thru window the file u want... http://i12.photobucket.com/albums/a209/tancfc/11444.jpg http://i12.photobucket.com/albums/a209/tancfc/fhfh.jpg
right click on task bar > properties > under Taskbar Appearance, select Group Similar taskbar buttons > is not my answer
While opening one Excel file I get an error message saying that a 2nd file could not be opened because it cannot be found. I do not want this 2nd file to open. WHere do I find the "command" that is telling this 2nd file to open.
I was working on a tax file yesturday, just a long long list of receipts. and the file is password protected. However, I went to open it today, and I get a message that says: "Filename.xls cannot be opened. the file may be read only, or you may be trying to access a read only location. Or, the server the file is located on may not be responding."
It's on my USB Drive. I've tried copying it to my HD so I can play with a copy, but no dice. When I try that, I get another error message, : Cannot copy Filename.xls. The file or directory is corrupted and unreadable. I've tried the various fixed suggested in the excel help files to no avail. I did a search on the forum, but didn't find anything that seemed to apply or help me. The computer I'm trying to open it on has Office 2003, the one I most recently worked on the file on has office XP. Not sure if this was a source of the problem. Doesn't seem like it should be. Hasn't been in the past. I'm not even getting to the dialogue box asking for my password yet.
For a project I need to develop excel spreadsheet that will contain two columns. First column will contain list of sale items. Other column will contain hyperlink to the items image as pdf file stored on hard drive somewhere. My requirement is to highlight row containing sale item, whoes pdf file is modified/updated since the last time user has opened the spreadsheet.
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.
I have a macro which opens two different hyperlinks in excel. Opened workbooks have are named like 1.asp and 2.asp. Both contains only one spreedsheet. I need to copy these spreedsheets to the Workbook, from which they are opened.
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
When I open a saved excel file I am having a problem with one workbook opening(a blank one), then the box saying that the program contains macros, and then the second actual workbook opening. I do not know what I changed somewhere alone the line, how to make just the one workbook I want (the second one) to open?
I use the vba to open excel file. like workbooks.open filename:=abc.xlsm but I found that if the file is opened by other. Excel still open the file but it will not notify user that it is opened as read only.
Would you add more line to notify user if the file is opened by other?
What is the easiest way to display in a cell the opened file's directory path where the file is stored? I would like to use some sort of formula (instead of the VB route) but I don't know if such a thing exists.
I've got a file that works fine on my computer. When I email it to anyone with 2010 and they open it from their email account (Outlook 2010), the file automatically opens up in 'Protected Mode'. If the user selects "Enable Editing" the user receives 'Run Time error 91: Object variable or with block variable not set'.
If the user closes out the vba error and saves the file to their computer and reopens the file, it works fine.
BTW, it is not a complex macro, it is error out at
I call it from a macro. It is supposed to write some temporary files, and close them in the end, and delete them. Sometimes, the dll can't close properly, and the text files remain open.
With error treatment in my macro, I can continue execution, but i need to delete that files.
Since the dll DOES NOT CLOSE the files, i'm not able to delete them in my macro.
I need some way to close that files, in order to delete them.
When I use GetFile to reference the file, it remains as "File", which does not accept "Close" method. I can reference the file with myfile.OpenAsTextStream, but this way it seems to me that the file is opened again, and the "Close" method does not work either, with the file defined as a TextStream object.
If I close excel, I'm able to delete those files, but that's not the way I want. Since IT'S OPEN IN EXCEL PROCESS, I imagine there's some way to close it.