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:
How do I work around this? Thanks!
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!