Open dbf file then close. do nothing..ignore any message.

M

musa.biralo

Hi,
i am simply trying to open a dbf file then close it without doing
anything and do not want to notify the user plus if any message comes
out i want to ignore it...(opening in the background)... i tried with,

'fileToOpen = "c:/path/musa.dbf"
'filenumber = FreeFile
'Open fileToOpen For Random Access As #filenumber
'Close #filenumber

it did nothing....then i tried with...

'Workbooks.Open Filename:=fileToOpen
'ActiveWindow.Close

this opens up the dbf file in excel and the problem is i have more data
than the excel limit so i got a message.....

Is there a way to open a dbf file in the background and close it
without doing anything to it and ignore any message??...what i found
is, without opening the file, excel can not get the data from the
file....So, just want to open then colse.....doing this thing manually,
everything works ok.

Thank you for you time...

musa.biralo
 
T

Tom Ogilvy

Workbooks.Open Filename:=fileToOpen

should be identical to do File=>Open and selecting your file in the dialog.

If there are more than 65535 records, then yes, you will not get all the
data, but that would be true for doing it manually.

If you say you have a manual methods that does what you want, then turn on
the macro recorder and perform that manual method. Then turn off the macro
recorder and look at the recorded code.

To suppress alerts

Application.DisplayAlerts = False
' code that could cause an alert
Application.DisplayAlerts = True
 
M

musa.biralo

Thanks Tom
you displayalerts = false worked. but what i having is...

if i open the excel manually then thigs are ok...so as you suggested
record macro, i did and it came with same code...

'Workbooks.Open Filename:=fileToOpen
'ActiveWindow.Close

Opening the dbf from this code does not update the formula in my cell.
But i open the dbf file manually, it works... don't know whats going
on....my formula is
=vlookup(a1,path,,,,,........... something like this...

Please help me....

musa.biralo
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top