+ Reply to Thread
Results 1 to 7 of 7

macros fail to work on extracted sheet (links to other data sources)

Hybrid View

  1. #1
    Registered User
    Join Date
    04-30-2013
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    6

    macros fail to work on extracted sheet (links to other data sources)

    I hope someone has a solution, because this is driving me bonkers!

    I have several macro buttons (not command buttons) on a sheet. One of the buttons extracts that sheet and saves the file to our server with a specific name (based on 2 cells) and to a specific folder. All of that is working fine. However, when that file is opened (by anyone OTHER than the original creator,) the macros no longer work and reference the original file name from the primary workbook.

    How can I get these macros to pertain to the active sheet and 'follow' the sheet to the new file (new name and new location) and NOT reference the original file?

    If I right click on the button, and click 'assign macro', the macro name is 'FILENAME'!MACRONAME. If I try to select the macro from the list below that, it just shows the MACRONAME, but when I click on it again, the filename returns to .

    The error that I get when I open it on any other machine is "This workbook contains links to other data sources." The file in question that it is trying to reference CANNOT be on the server, so that is not an option.

    Thanks in advance
    M

  2. #2
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: macros fail to work on extracted sheet (links to other data sources)

    Can you post the extraction and save code?
    If I've helped you, please consider adding to my reputation - just click on the liitle star at the left.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~(Pride has no aftertaste.)

    You can't do one thing. XLAdept

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~aka Orrin

  3. #3
    Registered User
    Join Date
    04-30-2013
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: macros fail to work on extracted sheet (links to other data sources)

    the 'test' file is the original (i have removed the other tabs due to company security.)
    the 'extracted' file is after the 'extract' button was pressed. the file was created to a location on our server.

    please let me know if you need more info.
    Attached Files Attached Files

  4. #4
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: macros fail to work on extracted sheet (links to other data sources)

    Hi MT,

    Maybe:

    Private Sub extract_page_Click()
    
    Application.ScreenUpdating = False
    ActiveSheet.Copy
    ActiveWorkbook.SaveAs _
    Filename:="T:\Project Equipment Lists\" & Range("F3") & _
    "-" & Range("B7") & ".xlsm", FileFormat:=52
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    
    End Sub

  5. #5
    Registered User
    Join Date
    04-30-2013
    Location
    usa
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: macros fail to work on extracted sheet (links to other data sources)

    I was finally able to try this out this morning, and I still get the same error. On the extracted sheet, it is trying to reference the macros from the original sheet.

  6. #6
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: macros fail to work on extracted sheet (links to other data sources)

    None of these are included in the extract:

    copy_job_number
    copy_project_addy
    copy_project_name
    copy_project_contact
    copy_equip
    copy_notes

    They need to be in the module with the others.

    Once you clean up the code, this may accomplish what you want:

    Private Sub extract_page()
    Dim P As String, N As String: P = ActiveWorkbook.Path: N = ActiveWorkbook.Name
    Dim FN As String: FN = P & "/" & N
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:= _
    "T:\Project Equipment Lists\" & Range("F3") & "-" & Range("B7") & ".xlsm", FileFormat:=52
    Workbooks.Open Filename:=FN
    Application.DisplayAlerts = True
    Application.ScreenUpdating = True
    End Sub
    Ignore the file, I couldn't detach it Check out this one instead TestBookXTract.xlsm
    Attached Files Attached Files
    Last edited by xladept; 10-08-2013 at 08:31 PM.

  7. #7
    Forum Guru xladept's Avatar
    Join Date
    04-14-2012
    Location
    Pasadena, California
    MS-Off Ver
    Excel 2003,2010
    Posts
    12,378

    Re: macros fail to work on extracted sheet (links to other data sources)

    Hi MT,

    Your buttons are specifying the source sheet. You may need to use ActiveX controls instead of the standard ones!

+ 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. Replies: 24
    Last Post: 03-21-2022, 08:01 AM
  2. advice:Links to other data sources
    By mr_teacher in forum Excel General
    Replies: 2
    Last Post: 05-16-2006, 09:30 AM
  3. Replies: 8
    Last Post: 03-16-2006, 02:25 PM
  4. [SOLVED] Workbook contains links to other data sources??
    By sbrimley in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-02-2006, 09:45 PM
  5. [SOLVED] Links to other data sources
    By Graham Haughs in forum Excel General
    Replies: 2
    Last Post: 02-25-2006, 10:00 AM

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