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
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