GetOpenFilename Properties
Nov 16, 2008
Is it possible to disable The "Look In:" field of the GetOpenFilename dialogue?
What I would like to do is to keep users from selecting folders other than the CurrentDirectory settings and if possible to keep the user from deleting,copying and pasteing to the files in the current dirrectory displayed. The code I have is:
View 4 Replies
ADVERTISEMENT
Jul 25, 2006
about the " getopenfilename" command.
1 - What exactly it can do?
2 - How can I work with it (like, to use the path of a file opened by it)?
View 5 Replies
View Related
Sep 10, 2009
I have the following code, is it possible to direct to a default directory that the file might be in? So when I open the dialog box it will automatically redirect a directory that is stored in VBA.
View 4 Replies
View Related
Jan 21, 2010
I want a macro that run the application GetOpenFilename (or something that is similar) but when I push the OK button, i don't want to open the file, I just want the filename of the file I have browsed to.
View 9 Replies
View Related
Jan 6, 2007
I have searched for the Runtime Error 13 in the archives and tried a few things that was suggested such as: If I change the Variables Dim FName as a String for instance it then errors in the middle bold area "If IsArray(FName) Then" as a Compile Error - Expected Array. I tried deleting the Option Explicit but that didn't do anything.
If I comment out the If FName = "False" Then routine it works.. however *that* is in there because if the user hits Cancel on the Getopenfilename box, it will just continue with the rest of the process. If the user hits cancel, I want it to stop, but since this code is in a module, it will kick back to the calling Userform sub and thats how it continues to run. The label caption change is setting a label caption to "cancel" if cancel was selected on the get openfilename dialog to exit out of all the UserForm Subs, Is there a way to pass a variable from a module to a userform?
Option Explicit
Sub GetData_Example5()
Dim SaveDriveDir As String, MyPath As String
Dim FName As Variant, N As Long
Dim rnum As Long, destrange As Range
Dim sh As Worksheet
Dim wsNew As Worksheet
SaveDriveDir = CurDir
MyPath = Application.DefaultFilePath 'or use "C:Data"
ChDrive MyPath
ChDir MyPath
FName = Application.GetOpenFilename(filefilter:="Excel Files,*.xls", _
MultiSelect:=True)
If FName = "False" Then
' They pressed Cancel
' Set Label Caption as Cancel so rest of routine can be Canceled
UserForm14.Label24.Caption = "Cancel".......................
View 6 Replies
View Related
Oct 29, 2008
When I use the GetOpenFilename() method, it seems to default to the particular users My Documents. Is there a way to force it to default elsewhere like a share drive, or the users desktop?
In the same line of thought, if I have a file named TestFile.xls. and I want to try to open it from the users desktop if they have it, how can I do this, since their desktop location is different than mine?
View 12 Replies
View Related
Oct 6, 2009
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.
I have tried different things to close it such as
View 2 Replies
View Related
Nov 29, 2009
I have several buttons on my userforms that use the following ...
View 12 Replies
View Related
Jun 18, 2006
I am using the GetOpenFilename method to allow the user to select a file to open:
vaFiler = Application.GetOpenFilename _
(FileFilter:="Adobe PDF Files (*.pdf),*.pdf", _
title:=Description, MultiSelect:=False)
What I would like to do is 'pre-load' the filename the user can select. They will be picking a file to attach to a part as a datasheet. Almost every single datasheet in the library has the part nuber as part of it's filename, so to make it a little quicker (and more accurate), I want pre-load the filename selection window with *partnr*.pdf. If nothing shows up, the user can delete filename I have entered for them and see all files in that directory.
View 3 Replies
View Related
Nov 4, 2006
I copied below code from one of Andy Pope's thread answers. Thanks Andy.
Private Sub CommandButton1_Click()
Dim vntFile As Variant
vntFile = Application. GetOpenFilename("Graphics Files (*.bmp; *.gif; *.jpg; *.jpeg),*.bmp;*.gif;*.jpg;*.jpeg," & _
"All File (*.*), *.*", Title:="Select Picture")
If vntFile <> False Then
ActiveSheet. Cells(27, 1).Value = vntFile
Image1.Picture = LoadPicture(vntFile)
Image1.PictureSizeMode = fmPictureSizeModeStretch
End If
End Sub
I would like to force the box to open in Views - Preview instead of List or Details or whatever it is at. I tried the following (and a bunch of other things), but I could not get it to work
With FileDialog
.InitialView = msoFileDialogViewPreview
End With
View 9 Replies
View Related
Mar 27, 2008
I'm having problems with the multiselect argument of the getopenfilename function. I've used this dozens of times with no problems, but now it doesn't work for me. I tried copying and pasting code that works in one module,
What I'm using is
Sub OpenFiles()
Dim vFiles As Variant, iNumfiles As Integer
vFiles = Application.GetOpenFilename(MultiSelect:=True)
If IsArray(vFiles) Then
For iNumfiles = LBound(vFiles) To UBound(vFiles)
MsgBox vFiles(iNumfiles)
Next iNumfiles
End If
End Sub
pretty simple, expect that when I select multiple files in the open dialog box, vfiles is a string containing one of the filenames, not an array containing them all! (by selecting, I simply highlight all the fiels I want and click open)
View 3 Replies
View Related
May 30, 2008
I'm writing a subroutine that asks the user to pick a file (using GetOpenFileName) and extracts some data from it, then closes the workbook it opened automatically.
Problem is that it seems I can only reference workbooks by index, which is a big problem if they have more than one workbook open. I don't want to have to force them to only keep 1 workbook open, that seems like bad practice.
importFile = Application.GetOpenFilename("Excel Files (*.xls), *.xls", , "Select field sheet")
If importFile = False Then Exit Sub
Workbooks.Open importFile ' Open the new workbook
importFile ends up returning something like, "C:Documents and SettingsMy DocumentsFieldBook.xls".....................
View 3 Replies
View Related
Apr 4, 2009
Need the code needed to call the following code from an insheet button.
View 2 Replies
View Related
Sep 17, 2008
I am opening the file through the GetOpenFilename method. I am facing an error in of the cases... Like say or example i try and open a file with the XYZ.xls...which is already open. the system generates a mess saying
"reopening will cause any changes you made to be discarded. do you want to reopen XYZ.xls?"
if i click yes...it works fine by reopening the file but when i click to No...Runtime error 1004 comes:
"Method open of object workbooks failed "
and its giving an error here in the Workbooks.Open Filename:=sFilename ......
View 9 Replies
View Related
Feb 13, 2010
I am trying to use Application.GetOpenFilename to search for a several (.jpg) files and list the file paths on a worksheet.
View 2 Replies
View Related
Apr 3, 2008
storedPath = .CustomDocumentProperties("PathCertString").Value
Although the question I'm about to ask is not related to Excel, but related to MS Word, the coding is similar.
The above code I used to set the properties value, but I get an error highlighting 'storedPath'. I speculate MS Word does not recognized this word. Is there another word or code that I can use to set the value in the MS Word document properties?
View 9 Replies
View Related
May 25, 2006
Within my code I have restricted the toolbar options that a user can access (i.e. for Menu Option 'Edit''Tools'):
Set myCmd = CommandBars("Worksheet menu bar").Controls("Edit")
myCmd.Controls("Delete Sheet").Enabled = False
But if the user wishes to delete the sheet, they can select the specific WorkSheet 'Tab' and Right-Click to Insert/Delete/Rename the sheet etc.
How do 'hide' these options within VBA? Or is there a Menu setting that I can be set to Enabled = False?
View 6 Replies
View Related
Mar 29, 2009
message box properties. i m using this
View 3 Replies
View Related
Dec 20, 2008
I would like to programatically add information to an Excel file's Properties, the Details tab. I have alot of files in the applicable group. Files are .xls but I'm using Excel 2007.
View 3 Replies
View Related
Oct 16, 2007
Is there a way to set the printer's properties using VBA?
Sometimes we set the printer for BEST quality to do photos or brochures. Well if we don't change it back, when we go to print a spreadsheet, it takes forever because it is set on best quality.
So......
I want to be able to set the print properties to normal using VBA.
View 9 Replies
View Related
Jul 26, 2008
I have a problem with the PivatTable properties in Excel and VBA. The problem is as follows:
This is a example table:
Sum of store_sales time_id product_id store_id 367 368 369 1 3 6 7 11,4 11 13 14
(the format is not real clear, but I will explain)
This is a part of a PivotTable where:
Sum of Store_sales is located in the datafield(one record; 11,4)
product_id and store_id are Row-Items
Time_id is a column item.
Now, I want the properties of the cell containing 11,4. I've made it so far in VBA that I can ask what his column-items and his row-item are.
Column = Application.Range(chosenCell).PivotCell.ColumnItems.Item(1)
Row = Application.Range(chosenCell).PivotCell.RowItems.Item(1)
Row2 = Application.Range(chosenCell).PivotCell.RowItems.Item(2)
But how do I get VBA to return the valueheaders of those columns and rows? So actually, I want VBA to also return the names: product_id, store_id and time_id. This is because I need those headers to create a query which I send to a Access database.
Is someone able to give me a hint? Is there a method for this in VBA?
View 9 Replies
View Related
May 16, 2006
where I can find a comprehensive list of '. Cells()' properties that I can Test for/Apply to Excel Cells?
i.e.
Cells(x,y).NumberFormat
I want to set Conditional Formatting using VBA,
to test for:
Data Type (Character, Integer, Date, Decimal, Logical)
Field Length (x(50), 999, 99/99/9999, 999.99, Yes/No)
from an imported file.
View 3 Replies
View Related
Sep 22, 2006
I have a workbook with 10 worksheets and I need to know the memory size for each worksheet. I know from File/ Properties that the file is 3.7mb but that is much higher than I would have expected. I can't tell which worksheets are causing it to be so large.
View 5 Replies
View Related
Feb 14, 2007
I have attach the lab2.xls files below.
1. Download “ Range Data.xls”.
2. Use the Offset and End properties of Range object to name range from A2 to the end of the column as “NEmployees”, range B1 to the end of the row as “NScores”,and the rest of the range, B2 to F19, as “ScoreData”.
3. Do some formatting using the range names and the With-End With construction: make the font of the NEmployees Range in bold and blue color; change the font of the NScores Range to italic, in red and centralize the text (using the HorizontalAlignment property).
View 9 Replies
View Related
Jul 17, 2014
I have this textbox class which I want to show a userform when clicked and prevent manual input.
[Code] .....
I would expect that I could also set some object properties like color, width, height, locked etc. in the class module.
However I can't find how to (seen all corners of the internet). How do I set these properties?
View 10 Replies
View Related
Aug 4, 2014
I am trying to use VBA to change the caption of checkboxes in "Sheet 2" when I change the value of a cell "A1" in "Sheet 1".
This code is working:
Private Sub Worksheet_Change(ByVal Target As Range)If Intersect(Target, ActiveSheet.Range("A1")) Is Nothing Then Exit Sub
Worksheets("Sheet 2").CheckBox1.Caption = "New Caption"End Sub
But there are 6 checkboxes in Sheet 2 and I would like to do something like this:
Private Sub Worksheet_Change(ByVal Target As Range)If Intersect(Target, ActiveSheet.Range("A1")) Is Nothing Then Exit Sub
For i = 0 to 5Worksheets("Sheet 2").Control("CheckBox" & i+1).Caption = "Box" & i+1Next iEnd Sub
This doesn't work.. So I guess the Control-function is wrong.
View 3 Replies
View Related
Oct 28, 2008
I have a button on a worksheet that activates a macro, the macro is stored in a "personal.xlsb" file. This file is copied to several users computers so they can use the macro, problem is once the button is assigned to a macro from one computer all the other users can't use the macro. What can I do to make this macro work on all computers? (Less placing yet another button on the tool bar).
View 2 Replies
View Related
Apr 2, 2009
How does one access the properties of a shape? For instance getting the text on a button ( from the forms toolbar ) on a worksheet. This works
View 4 Replies
View Related
Mar 1, 2012
I have a folder with some 126 word document files.
What I need is to create list of file names in a column & its properties like Author, Date modified in adjacent columns of each file..
View 1 Replies
View Related
Mar 31, 2013
I have a series of shapes (circles) that I wish to use as a substitute to the radio buttons found in the form controls (too small).
I've drawn the shapes, but wish to manipulate their properties in VBA. For example, when the user clicks on the shape, the macro includes VBA which will change the properties to include colour and fill. Of course, clicking it again, will send it back to the default.
How can I get the VBA of the current shape's (default) properties? Where can I find a list of the VBA properties available to any particular shape so I know what fields are available to set attributes to?
View 2 Replies
View Related