|
|
#1 |
|
Beta Member
Join Date: Nov 2011
Posts: 2
|
Hey, I dont know much about macros or about scripting, but I've got a project to do for work and I looked up some codes and spliced them togeather to fit my specific purpose. |
|
|
|
|
|
#2 |
|
In Runtime
Join Date: Mar 2011
Posts: 274
|
I have no idea what you mean by this statement: "The latter should fit onto the former and make one address, but I'm having trouble with the connection point where the & is located." I put your code into an Excel sheet and it worked fine as-is. I put the subfolder name in cell A7 and the pic name in cell B9. The pic is in a subfolder below the folder the Excel sheet is in. Your code loaded the picture fine.
Opening a subfolder to select a file from it is done with the FileDialog object. Here's some example code from the MS site that should get you started: Code:
Sub Main()
'Declare a variable as a FileDialog object.
Dim fd As FileDialog
'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFilePicker)
'Declare a variable to contain the path
'of each selected item. Even though the path is a String,
'the variable must be a Variant because For Each...Next
'routines only work with Variants and Objects.
Dim vrtSelectedItem As Variant
'Use a With...End With block to reference the FileDialog object.
With fd
'Use the Show method to display the File Picker dialog box
'The user pressed the action button.
If .Show = -1 Then
'Step through the FileDialogSelectedItems collection.
For Each vrtSelectedItem In .SelectedItems
'vrtSelectedItem contains the path of each selected item.
'Here use any file I/O functions you want on the path.
'This example simply displays the path in a message box.
MsgBox "The path is: " & vrtSelectedItem
Next vrtSelectedItem
'The user pressed Cancel.
Else
End If
End With
'Set the object variable to Nothing.
Set fd = Nothing
End Sub
|
|
|
|
|
|
#3 |
|
Beta Member
Join Date: Nov 2011
Posts: 2
|
Oh! I realized what I did. Thanks!
lol I was so focused on the two folders that changed that I forgot that they were both located in a folder that shares the same location as the excel file. I just had to add the \SCAN SHEET COPIES before the "\" & subfolder &.... and it worked.
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|