If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Run-time error '1004' in import macro

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-19-03, 03:22
geeorbit geeorbit is offline
Registered User
 
Join Date: Sep 2003
Location: Hyderabad
Posts: 5
Run-time error '1004' in import macro

I have written a macro to import data from a text file into a new excel file, copy that data to the database and finally delete the new file opened for importing purpose.
However the command .Refresh BackgroundQuery:=False
gives:
Run-time error '1004'
Application-defined or object-defined error.

At times it executes without any error.
Any clue regarding how I can solve this ?

Thanks in advance
Reply With Quote
  #2 (permalink)  
Old 11-26-03, 05:08
yannfoubert yannfoubert is offline
Registered User
 
Join Date: Nov 2003
Posts: 2
Question Re: Run-time error '1004' in import macro

Quote:
Originally posted by geeorbit
I have written a macro to import data from a text file into a new excel file, copy that data to the database and finally delete the new file opened for importing purpose.
However the command .Refresh BackgroundQuery:=False
gives:
Run-time error '1004'
Application-defined or object-defined error.

At times it executes without any error.
Any clue regarding how I can solve this ?

Thanks in advance
Hi!

Did you have the solution for your problem? I have the same one and can't find out what's going wrong.

Thanks in advance.

Yann
Reply With Quote
  #3 (permalink)  
Old 11-26-03, 15:27
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
I suspect that because you deleted the original text file, Refresh is looking for it but can't find it - hence "Application-defined or object-defined error".
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #4 (permalink)  
Old 02-17-04, 01:33
kenji4861 kenji4861 is offline
Registered User
 
Join Date: Feb 2004
Posts: 2
I'm having the same problem.

This problem does occur if the file does not exist, but it also happens on bigger files. Also seems to occur less on the PC, but occurs more on the Mac.. (I'm using this on Excel).
Reply With Quote
  #5 (permalink)  
Old 02-17-04, 05:51
yannfoubert yannfoubert is offline
Registered User
 
Join Date: Nov 2003
Posts: 2
Quote:
Originally posted by kenji4861
I'm having the same problem.

This problem does occur if the file does not exist, but it also happens on bigger files. Also seems to occur less on the PC, but occurs more on the Mac.. (I'm using this on Excel).
I finally found the problem I had. My macro made a request to a database, then I wanted to report the result in Excel. The problem was that some data began by char like '-', '+' or '=' which are interpreted as functions in Excel. I just corrected it by adding a ''' at the begining of each string having these char at first.

In fact, this error can have many reasons. It's not a very accurate message... Something like a dummy error. One more time thanks Bill!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On