Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with Find/Replace in Excel from Access

Status
Not open for further replies.

eAlchemist

Technical User
Aug 28, 2003
64
0
0
US

I have some code that opens an Excel file, and among other things removes quotation marks from the file. I set display alerts to false, but when it doesn't find a quote, I still get a message box letting me know. Anyone have any ideas on how to suppress this? Here is a snippet of the code:

Code:
 With myExcel
    .DisplayAlerts = False
    Workbooks.Open Filename:=(myPath & myFileName)
 
    Cells.Select
    
    Selection.Replace What:=Chr(34), Replacement:="", _    
        LookAt:=xlPart, SearchOrder:=xlByRows, _
        MatchCase:=False, SearchFormat:=False, _
        ReplaceFormat:=False
    
    ActiveWorkbook.Save
        ActiveWorkbook.Close

    .DisplayAlerts = True

End With

Thanks,
Chris
 



Hi,

Try...
Code:
...[b]
    Activesheet.[/b]Cells.Select
...

Skip,
[sub]
[glasses] [red][/red]
[tongue][/sub]
 
With myExcel
.DisplayAlerts = False
[highlight].[/highlight]Workbooks.Open Filename:=(myPath & myFileName)
[highlight].[/highlight]Cells.Select
[highlight].[/highlight]Selection.Replace What:=Chr(34), Replacement:="", _
LookAt:=xlPart, SearchOrder:=xlByRows, _
MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
[highlight].[/highlight]ActiveWorkbook.Save
[highlight].[/highlight]ActiveWorkbook.Close
.DisplayAlerts = True
End With

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top