Issue with VBA

  • Thread starter Thread starter Bertrand
  • Start date Start date
B

Bertrand

Hi,

I have a problem with VBA. When I open my spreadsheet and call a VBA
procedure that calls an optimization software (called Xpress-MP), I get
an error linked to the execution of the model in XPress-MP.
I found an intriguing way of solving my problem: by just using the "save
as" command of Excel and saving my Excel file with the same name or any
other name and then re-running the VBA procedure, everything works. This
suggests to me that by using "save as" some parameters of Excel or VBA
are reset and make my VBA code works fine.
Please let me know what I need to do inside my VBA code to solve what
seems to be an initialization problem.

Thanks a lot for your help.

** Posted via: http://www.ozgrid.com
Excel Templates, Training, Add-ins & Business Software Galore!
Free Excel Forum http://www.ozgrid.com/forum ***
 
This sounds like a problem with Xpress-MP.

When you save or SaveAs a Workbook the Before Save Event is fired. To
see this Event, right click on the Excel icon, top left next to "File"
and select "View Code". In here paste this

Private Sub Workbook_BeforeSave _
(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If SaveAsUI = True Then
MsgBox "You are going to Save as"
Else
MsgBox "Normal save"
End If
End Sub

This should help???

** Posted via: http://www.ozgrid.com
Excel Templates, Training, Add-ins & Business Software Galore!
Free Excel Forum http://www.ozgrid.com/forum ***
 
Back
Top