+ Reply to Thread
Results 1 to 2 of 2

Automate Opening Files

  1. #1
    Steven
    Guest

    Automate Opening Files

    I have a master excel file with a column for file names and in the next
    column the password. For example:

    B3 contents is: C:\My Documents\Export.xls C3 contents is: pwtest

    I put a macro in the code of the sheet so when I double click on B3 it opens
    the file to where you input the password. Is there a way to automatically
    fill in the password with the contrents of C3?

    So far I have been doing like this in the BeforeDoubleClick of the Sheet:

    ----------------------------------------------

    On Error GoTo Macro1_Err

    vOpen = ActiveCell.Value

    ActiveCell.Offset(0, 1).Range("A1:A1").Select

    If IsEmpty(ActiveCell.Value) Then
    Else
    Selection.Copy
    End If
    ActiveCell.Offset(0, -1).Range("A1:A1").Select
    Workbooks.Open Filename:=vOpen

    '**Note: I am stuck here. I can hit Ctrl-V because I did a
    '**Selection.copy on the password above but what I really
    '**want is to have the password fill in automatic.

    Macro1_Exit:
    Exit Sub

    Macro1_Err:
    Resume Macro1_Exit

    ----------------------------------------------

    Thank you for your help.

    Steven

  2. #2
    Pete McCosh
    Guest

    RE: Automate Opening Files


    Workbooks.Open Filename:=range("B3").value password:=range("C3").value

    Cheers, Pete

    "Steven" wrote:

    > I have a master excel file with a column for file names and in the next
    > column the password. For example:
    >
    > B3 contents is: C:\My Documents\Export.xls C3 contents is: pwtest
    >
    > I put a macro in the code of the sheet so when I double click on B3 it opens
    > the file to where you input the password. Is there a way to automatically
    > fill in the password with the contrents of C3?
    >
    > So far I have been doing like this in the BeforeDoubleClick of the Sheet:
    >
    > ----------------------------------------------
    >
    > On Error GoTo Macro1_Err
    >
    > vOpen = ActiveCell.Value
    >
    > ActiveCell.Offset(0, 1).Range("A1:A1").Select
    >
    > If IsEmpty(ActiveCell.Value) Then
    > Else
    > Selection.Copy
    > End If
    > ActiveCell.Offset(0, -1).Range("A1:A1").Select
    > Workbooks.Open Filename:=vOpen
    >
    > '**Note: I am stuck here. I can hit Ctrl-V because I did a
    > '**Selection.copy on the password above but what I really
    > '**want is to have the password fill in automatic.
    >
    > Macro1_Exit:
    > Exit Sub
    >
    > Macro1_Err:
    > Resume Macro1_Exit
    >
    > ----------------------------------------------
    >
    > Thank you for your help.
    >
    > Steven


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1