akshay0880
New Member
- Joined
- Jul 11, 2021
- Messages
- 16
- Office Version
- 365
- Platform
- Windows
Hello.
I am trying the below code to generate a text file (with the extension .RG) but when running it says Path/File access error.
Please note that i am trying to save the generated text file on the same location as the workbook is saved.
I am not sure how to specify the path (if needed). Can someone please help me out?
Sub Card_RG()
Dim FileName As String
FileName = Range("Q1") & "CARD.RG"
Open FileName For Output As #1
Print #1, "B" & Range("Q1") & " YD"
Close #1
MsgBox ("CARD.RG Created")
End Sub
I am trying the below code to generate a text file (with the extension .RG) but when running it says Path/File access error.
Please note that i am trying to save the generated text file on the same location as the workbook is saved.
I am not sure how to specify the path (if needed). Can someone please help me out?
Sub Card_RG()
Dim FileName As String
FileName = Range("Q1") & "CARD.RG"
Open FileName For Output As #1
Print #1, "B" & Range("Q1") & " YD"
Close #1
MsgBox ("CARD.RG Created")
End Sub