SirCurious_VBAExcel
New Member
- Joined
- Sep 30, 2014
- Messages
- 17
Hello,
I am a VBA "dummy" so please bear with me.
I am currently working on a "Lookup" program. There is an Export button on my user form, but the text file generated saves automatically in a user's directory (e.g., My Documents).
Here is the code:
Private Sub Export_Click()
Dim OutCount As Integer
'exports the list to a text file (max 200 rows)
If ItemCount > 0 Then
Open "PRODLIST.txt" For Output As #1
For OutCount = 1 To ItemCount
If ItemCount < 201 Then
Print #1, ListArray(OutCount)
End If
Next
Close #1
MsgBox ("List output to file PRODLIST.txt saved to your default directory")
If ItemCount > 200 Then
MsgBox ("Warning - list incomplete - only contains first 200 entries")
End If
End If
End Sub
________________________________________________________________
Now my question: How can I get the SaveAs prompt window instead of the text file saving automatically to My Documents?
I looked around and got:
FILENAME = Application.Dialogs(xlDialogSaveAs).Show
_____________________________________________
I can't figure out how to modify my existing code.
Any insight would be greatly appreciated!
I am a VBA "dummy" so please bear with me.
I am currently working on a "Lookup" program. There is an Export button on my user form, but the text file generated saves automatically in a user's directory (e.g., My Documents).
Here is the code:
Private Sub Export_Click()
Dim OutCount As Integer
'exports the list to a text file (max 200 rows)
If ItemCount > 0 Then
Open "PRODLIST.txt" For Output As #1
For OutCount = 1 To ItemCount
If ItemCount < 201 Then
Print #1, ListArray(OutCount)
End If
Next
Close #1
MsgBox ("List output to file PRODLIST.txt saved to your default directory")
If ItemCount > 200 Then
MsgBox ("Warning - list incomplete - only contains first 200 entries")
End If
End If
End Sub
________________________________________________________________
Now my question: How can I get the SaveAs prompt window instead of the text file saving automatically to My Documents?
I looked around and got:
FILENAME = Application.Dialogs(xlDialogSaveAs).Show
_____________________________________________
I can't figure out how to modify my existing code.
Any insight would be greatly appreciated!