View Single Post
  #5   Spotlight this post!  
Unread 06-11-2014, 15:39
indieFan indieFan is offline
RoboDox and LVHS - Missing you!
FRC #5941
Team Role: Engineer
 
Join Date: Jan 2002
Rookie Year: 2001
Location: Seattle (was SoCal, then SA,TX))
Posts: 382
indieFan has a reputation beyond reputeindieFan has a reputation beyond reputeindieFan has a reputation beyond reputeindieFan has a reputation beyond reputeindieFan has a reputation beyond reputeindieFan has a reputation beyond reputeindieFan has a reputation beyond reputeindieFan has a reputation beyond reputeindieFan has a reputation beyond reputeindieFan has a reputation beyond reputeindieFan has a reputation beyond repute
Re: Non-Robotics: VBA for Excel?

That seemed to fix the issue, although I'm not sure why. Now I have a problem when saving the file that I can't solve. The code that works just fine for Excel 2007, but not 2013.

My code is as follows:

Private Sub SaveFormattedFile()
'This function saves the workbook in the same location with the .xlsx extension.

Dim NameOfWorkbook As String, FileNameToSave As String 'Declare variable

'Get the filename without the extension.
NameOfWorkbook = Left(ActiveWorkbook.Name, (InStrRev(ActiveWorkbook.Name, ".", -1, vbTextCompare) - 1))

FileNameToSave = NameOfWorkbook & ".xlsx" 'Add the new file extension to save.

'Save the workbook as a .xlsx file.
ActiveWorkbook.SaveAs FileNameToSave, FileFormat:=51

End Sub