+ Reply to Thread
Results 1 to 4 of 4

How to declare Sub and Function at the same line?

  1. #1
    Registered User
    Join Date
    10-04-2021
    Location
    london, england
    MS-Off Ver
    32
    Posts
    2

    How to declare Sub and Function at the same line?

    I have an excel vba macro which downloads a single file. In a 64-bit office it runs well but I'm facing problems in 32-bit version in declarations section.

    The code in 64-bit is like this: pastebin /0uqVR60p (since im a new member im not allowed to post links yet)

    but in 32-bit version it brings me errors like "Expected Sub or Function" and highlights PtrSafe then I fixed this by adding "Sub" before "PtrSafe" but it gave me another error which says "Expected Lib" then I fixed this by removing "Function Test" but now I have to declare this function somewhere because it is used on the code.



    Can someone help me please?

  2. #2
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,903

    Re: How to declare Sub and Function at the same line?

    I suggest you read this as it will show you how to work with 32 and 64 bit Office with API calls: https://jkp-ads.com/Articles/apideclarations.asp
    Rory

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,460

    Re: How to declare Sub and Function at the same line?

    Welcome to the forum.

    There is no version 32 of MS Office (32-bit is a flavour, not a version) - which version are you using? Please update your profile. Thanks.

    There are instructions at the top of the page explaining how to attach your sample workbook.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    10-04-2021
    Location
    london, england
    MS-Off Ver
    32
    Posts
    2

    Re: How to declare Sub and Function at the same line?

    Damn it was fixed like a charm. Thanks a lot!!

+ 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. Public Declare Function FindWindowA in 64bit
    By Vlad717 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-08-2018, 06:25 AM
  2. Excel VBA Function Method API Windows Function User32.dll Alias Declare Library List . :)
    By Doc.AElstein in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 01-17-2018, 07:51 PM
  3. Declare and Initialize on the Same Line
    By aelias3 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-31-2013, 06:37 AM
  4. VBA Function to Declare Yes = 100 and No = 0
    By akwishestofish in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-24-2013, 02:30 PM
  5. How do I declare a function whose output is an array?
    By Schizoid Man in forum Excel General
    Replies: 1
    Last Post: 05-24-2006, 05:30 PM
  6. How can use LONGLONG type of C++ Dll in 'Declare Function' statement?
    By Zoo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-10-2006, 07:10 AM

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