+ Reply to Thread
Results 1 to 6 of 6

VBA error 1004

  1. #1
    Registered User
    Join Date
    07-07-2014
    Location
    the Netherlands
    MS-Off Ver
    2016
    Posts
    56

    VBA error 1004

    I get an error 1004 "Application-defined or object-defined error". with the subroutine:

    Sub test()
    Dim I As Double
    Dim Map As String
    Dim ActualFileName As String
    Dim MapAndFile As String
    Dim Index As Integer
    Dim WorksheetNaam As String

    I = 67091

    WorksheetNaam = "Dir"
    Map = "D:\Foto's en video's\Fotos\Familie\FritsEnMo\2004\Mei\Wouter"
    ActualFileName = "Frits240b24e3a6.jpg"
    Cells(I, 4) = ActualFileName
    MapAndFile = Map & "\" & ActualFileName
    With Worksheets(WorksheetNaam)
    .Hyperlinks.Add .Cells(I, 6), MapAndFile
    End With

    End Sub


    With I up to 67090 there are no problems, but from I=67901 and higher I get the error 1004 message on '.Hyperlinks.Add .Cells(I, 6), MapAndFile'.

    The http://msdn.microsoft.com/en-us/libr...ice.15%29.aspx gave me no solution.

    Can anyone helps me?

    With kind regards

    Jan Lichtenbelt

  2. #2
    Registered User
    Join Date
    08-20-2014
    Location
    Toronto, Canada
    MS-Off Ver
    2013
    Posts
    95

    Re: VBA error 1004

    Try changing

    Please Login or Register  to view this content.
    to

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    07-07-2014
    Location
    the Netherlands
    MS-Off Ver
    2016
    Posts
    56

    Re: VBA error 1004

    Dear efarkouh

    The result is unchanged.

    Jan Lichtenbelt

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: VBA error 1004

    Jan

    Is F67091 protected?

    PS Can you add code tags when posting code?
    If posting code please use code tags, see here.

  5. #5
    Registered User
    Join Date
    07-07-2014
    Location
    the Netherlands
    MS-Off Ver
    2016
    Posts
    56

    Re: VBA error 1004

    Dear Norie,

    Background information:
    The worksheet "Dir", with about 100,000 records, is automatically created by importing the file dir.txt. And dir.txt has been created by the in cmd with dir /s >>dir.txt.
    This means that I do not expect the record 67091 to be protected. Moreover, the error record results in column 6 (F) in the full filename (with direcory) in stead of the wanted hyperlink. That means writing to cells(67091,6) is still possible.

    With kind regards

    Jan Lichtenbelt

  6. #6
    Registered User
    Join Date
    07-07-2014
    Location
    the Netherlands
    MS-Off Ver
    2016
    Posts
    56

    Re: VBA error 1004

    Dear All,

    The problem is solved for me. The program works. But unfortunately I do not know why the problem has been solved.


    With kind regards

    Jan Lichtenbelt

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Runtime error '1004': Paste special method of range class error.
    By Daryl Zer0 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 11-05-2014, 01:44 AM
  2. [SOLVED] VBA Error: Runtime Error 1004: AutoFilter method of Range class failed
    By jl22stac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-03-2013, 07:27 PM
  3. [SOLVED] Getting Error 1004 Object or Application Defined Error - Code to rearrange data
    By BlazzedTroll in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 06-10-2013, 12:10 PM
  4. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  5. Error 75 File/Path access error, sometimes Error 1004
    By smokebreak in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 02-16-2011, 02:35 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1