+ Reply to Thread
Results 1 to 3 of 3

Workbook.Open (Path) Not working

  1. #1
    Registered User
    Join Date
    11-20-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Workbook.Open (Path) Not working

    Hi -

    I've been really struggling with this one. I am trying add a value from an open workbook to a closed workbook and then add a status code 6 positions to the right, an "A". I have tried several different ways and used many others code and manipulating them but I am continually getting object errors even if the objects are declared and set. Now when I run the code, I get something flashing in the background and instead of my workbook name in the project window where my macro resides, (my workbook name: "Approve PO.XLSM") it switches to FUNCRES.XLAM and the screen flickers and the macro ends. I can't see anything in the watcher window. I am not very good with code so any help will be appreciated. Here is the line of code where it happens, Set OutputFile = Workbooks.Open("J:\Manual PO's\Manual PO Log\Manual PO Log.xlsx")....it is expecting a function or variable?


    Sub Update_Log_Status()
    Dim InputFile As Workbook
    Dim OutputFile As Workbook
    Dim Inputpath As String
    Dim Outputpath As String
    Dim sht1 As Worksheet
    Dim gFound As Range


    'copy what you want from InputFile:
    Set InputFile = ActiveWorkbook

    ''Workbooks.Open Filename:="C:\WorkbookName1.xls"

    '## Open both workbooks first:
    Set OutputFile = Workbooks.Open("J:\Manual PO's\Manual PO Log\Manual PO Log.xlsx")
    'Grab the first sheet
    Set sht1 = OutputFile.Sheets(1)

    'Workbooks.Open ("J:\UML_Inventory\Manual PO's\Manual PO Log\Manual PO Log.xlsx")


    'paste to OutputFile worksheet:
    ActiveSheet.Range("B21").Value = OutputFile.Worksheets("Log").Range("L1").Value

    Set rgFound = Range("D:D").Find(Range("L1").Value, After:=Range("D3"))

    If rgFound Is Nothing Then
    Debug.Print "Selection not found"
    Else

    End If

  2. #2
    Valued Forum Contributor
    Join Date
    09-19-2008
    Location
    It varies ...
    MS-Off Ver
    Office365 - 64bit
    Posts
    862

    Re: Workbook.Open (Path) Not working

    Not sure if this is the reason but you've got a possessive apostrophe in the path name (PO's) that might be causing issues.
    MatrixMan.
    --------------------------------------
    If this - or any - reply helps you, remember to say thanks by clicking on *Add Reputation.
    If your issue is now resolved, remember to mark as solved - click Thread Tools at top right of thread.

  3. #3
    Registered User
    Join Date
    11-20-2013
    Location
    US
    MS-Off Ver
    Excel 2010
    Posts
    16

    Re: Workbook.Open (Path) Not working

    Thanks, I'll try it

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Workbook.open a filename with path and cell value in it
    By dutchmaste in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 06-16-2016, 09:02 PM
  2. [SOLVED] Open another workbook from current Directory as Path using VBA
    By gr8spot in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 08-01-2015, 07:03 AM
  3. Macro to open a workbook from an unknown file path
    By paul_sykes00 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 12-03-2012, 02:42 AM
  4. Open different workbook in different path at the listbox
    By ccs1981 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-01-2008, 12:53 AM
  5. Use cell in open workbook to id path to wanted data
    By NickiName in forum Excel General
    Replies: 3
    Last Post: 05-10-2007, 02:04 PM
  6. Open Workbook using URL instead of network path
    By Raul in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-01-2006, 11:55 AM
  7. Get path of open workbook
    By Selina in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-29-2005, 01:50 AM

Tags for this Thread

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