Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Workbooks.Add with Excel in Browser

Status
Not open for further replies.

jennuhw

MIS
Apr 18, 2001
426
US
I have code to open a new workbook and copy a sheet to it. This works great if the spreadsheet is opened directly in Excel. The problem is if the workbook is opened in IE (where it will be accessed) it fails on the workbooks.add line with the following error:
Method 'Add' of object 'Workbooks' failed

Here is my code:
Code:
fname = ThisWorkbook.Name
'
    Application.ScreenUpdating = False
    Set newWB = Workbooks.Add
    Windows(fname).Activate
    Sheets("Quote Form").Select
    Cells.Select
    Selection.Copy
    newWB.Activate
    ActiveSheet.Paste
    Application.CutCopyMode = False
    With Selection.Font
        .Name = "Verdana"
        .Size = 10
        .Strikethrough = False
        .Superscript = False
        .Subscript = False
        .OutlineFont = False
        .Shadow = False
        .Underline = xlUnderlineStyleNone
        .ColorIndex = xlAutomatic
    End With
    ActiveWindow.zoom = 75

How do I work around this? Thanks!
 
I haven't found a work around. Does anyone have any ideas why this is causing an error?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top