View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
HigherImpact HigherImpact is offline
external usenet poster
 
Posts: 1
Default downloading excel file for open causes "file is locked for editing

I have excel files that have visual basic code.

When these excel files are downloaded from the web and opened (they are
downloaded into a temporary folder and have a name like test[2].xls), we get
an error "file is locked for editing". When the file is downloaded and
saved, then opened, everything works fine.

Auto open works fine, but the error occurs when trying to call
RFRsummary_menu_add.

I have also tried calling RFRsummary_menu_add directly from auto open, but
that fails too.

Sub Auto_Open()
Application.Worksheets("RFR Summary").OnSheetActivate =
ActiveWorkbook.Name & "!Module1.RFRsummary_menu_add"
Application.Worksheets("RFR Summary").OnSheetDeactivate =
ActiveWorkbook.Name & "!Module1.RFRsummary_menu_del"
Application.Worksheets("RFR Details").OnSheetActivate =
ActiveWorkbook.Name & "!Module1.RFRdetails_menu_add"
Application.Worksheets("RFR Details").OnSheetDeactivate =
ActiveWorkbook.Name & "!Module1.RFRdetails_menu_del"
End Sub

Sub RFRsummary_menu_add()
MenuBars(xlWorksheet).Menus.Add Caption:="RFR Print"

MenuBars(xlWorksheet).Menus("RFR Print").MenuItems.Add _
Caption:="Print RFR Summary", _
OnAction:="Print_Summary"
End Sub