Problem with quotes appearing in .prn file when I don't see them in excel

HunterN

Active Member
Joined
Mar 19, 2002
Messages
479
Hi all,

I have VBA code that currently pastes rows of data that I have on one sheet to a temporary sheet. This works just fine. I then do the following to save it to a .prn file extension.

Sub MoveDatatoFile ()

'** Activate the Temp sheet again
Workbooks(CurrentWkb).Activate
Selection.Insert

'** Enter the MIF Title line
Range("A1").Select
Selection.Insert

Worksheets("Temp").Rows(1).Insert
ActiveCell = "#METADATA INTERFACE FILE (MIF)"


'** Save it to an ASCII file
HoldMIF_file = MIFpath & "\" & hold_Year & "\" & _
hld_MIF_file & ".prn"


Call Copy_Page

Range("A1").Select
Application.ScreenUpdating = True
End Sub


Sub Copy_Page()
Sheets("Temp").Copy
On Error GoTo FileNotSaved

ActiveWorkbook.SaveAs Filename:=HoldMIF_file, FileFormat:=xlText

Exit Sub

FileNotSaved:
MsgBox "The file was not saved!"
Resume Next

End Sub


Then I go back to the original calling module and do the following:

'** Display of message box
myTitle = "MIF FILE"
myMsg = "Your MIF file has been created in: " & vbLf & _
myPath & hold_Year & vbLf & vbLf & _
"Would you like to print a copy?"
Response = MsgBox(myMsg, vbYesNo, myTitle)

If Response = vbYes Then
ActiveSheet.PrintPreview
End If


So this is what I am dealing with. The worksheet gets copied perfectly. The PrintPreview opens up and shows me the file and everything looks great, I have no quotes around rows of words. So I get out of my vba application and go directly to the area where I saved it to and open it using NOTEPAD. Now I have the problem, at different places on my sheet I have quotes around whole rows of data. I do not know what causes the quotes and I only see them when I open the .prn file that I have created.

I hope someone can help me with this. I have searched this site for others that have had similar problems but can't find the actual work around. One said open NOTEPAD and click edit replace " with blank and click replace all. That does work once I have opened NOTEPAD, but I don't want the user to have to open it and do that. I am hoping for a way to do this in VBA. Thanks,

Nancy
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,214,622
Messages
6,120,576
Members
448,972
Latest member
Shantanu2024

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top