I have been trying to figure this out for days and it is driving me nuts because it should be super simple. I have a code that saves cells to a text file and that code works perfectly. However, I would like to alter the code to start at a certain location when the Save As window pops up. Right now it defaults to where the workbook is saved. Is this possible? I'm on a Excel 2011 for Mac.
Here is my current code:
Sub Graphic3()
Dim flag As Boolean
Dim i As Integer
Dim strPath As String
On Error GoTo lblError:
strPath = Application.GetSaveAsFilename(InitialFileName:=MyInitialFilename)
Open strPath For Output As #4
If Cells(10, 2) <> "" Then
'write the data to the file
Write #4, Cells(7, 4) & Chr(10) & Cells(10, 4) & Chr(10) & Chr(10) & Cells(7, 5) & Chr(10) & Cells(10, 5) & Chr(10) & Chr(10) & Cells(7, 6) & Chr(10) & Cells(10, 6) & Chr(10) & Chr(10) & Cells(7, 7) & Chr(10) & Cells(10, 7)
'go to next cell
End If
'close the file
Close #4
Exit Sub
lblError:
Err.Clear
End Sub
Any and all help is greatly appreciated! Thank you!
Bookmarks