Results 1 to 2 of 2
  1. #1
    thart21 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    83

    DocName alias and TransferSpreadsheet

    I am using the TransferSpreadsheet method to export a query to a new excel workbook/worksheet. My users need the tab of the new worksheet to be called "Sheet1" due to some vlookups they have in another workbook. I have tried to use the "Range" property but it doesn't seem to work. It is naming the tab the same as my query. Is there a way to give it an alias of "Sheet1" somewhere in my VBA code?
    I don't want them to have to open the spreadsheet and rename it each time if possible.

    Private Sub cmdSP11_Click()
    On Error GoTo Err_cmdSP11_Click


    Dim stDocName As String

    stDocName = "qSource_Data_SP11" --alias this to "Sheet1" ??

    'DoCmd.OpenQuery stDocName, acNormal, acEdit
    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, stDocName, filepath\\SP11\SP11___Download.xls"


    Exit_cmdSP11_Click:
    Exit Sub
    Err_cmdSP11_Click:
    MsgBox Err.Description
    Resume Exit_cmdSP11_Click

    End Sub

  2. #2
    thart21 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Mar 2010
    Posts
    83
    Of course, finally figured it out right after posting.

    DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel8, stDocName, filepath\\SP11\SP11___Download.xls", False, "Sheet1".

    I had also before posting changed it to TypeExcel8 from Excel9 this morning. Not sure if that was it but will check it out later.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Transferspreadsheet Help Please
    By graviz in forum Programming
    Replies: 0
    Last Post: 11-30-2009, 02:56 PM
  2. user alias
    By ukgooner in forum Queries
    Replies: 0
    Last Post: 08-25-2009, 05:03 AM
  3. Can't get TransferSpreadsheet to work
    By Valeda in forum Import/Export Data
    Replies: 0
    Last Post: 07-19-2007, 08:04 AM
  4. transferSpreadsheet
    By rabbit in forum Import/Export Data
    Replies: 1
    Last Post: 06-09-2006, 04:01 PM
  5. transferspreadsheet function
    By jeffj in forum Import/Export Data
    Replies: 3
    Last Post: 03-13-2006, 11:59 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums