Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21
  1. #16
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    Do you have a reference set for Microsoft Excel???

    What is the format for the output to be sent to tax lawyer?
    You do not necessarily have to use Excel to get csv output.(as has been said)

    You may get more focused help if you provided some test data.

    You will also help yourself by creating a conceptual model of the business to show where and how
    billing , purchase, inventory, production, and payment tracking fit together.



    It's analogous to building an airplane or shopping centre --you do some general analysis to identify basic requirements. You find that some pieces will have to conform to some dimensions or weight or location in order to fit together. You end up with a developer's conceptual view of the product; and as you get to more detail, you may have to revise some things, but you do so from a point of knowledge --NOT discovering that wings or a third storey are required after the fuselage (or second level parking lot) has been fabricated.

    Good luck.

  2. #17
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    As orange stated, need to select the Microsoft Excel reference library in the VBA editor:

    Tools > References
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #18
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    Tried running your code, but it give a vba error saying User-Defined type not defined. The error occurs on line where X1 is set as Excel.application
    June provided code xl (lower case X, lowercase L), you have used X1. No problem in using something different, but is indicative that you have not copied the code, so you are asking us to solve a problem with the code provided, and not the code you are actually using. Often this is self defeating since the error may be in how you typed the code, not in how it was presented to you. So a tip for the future, if you have a problem with the code, copy and paste the code you are actually using

    In June's case the code provided indicates that a reference to the excel library has been loaded, because it references excel.application, so in theory, you need to do the same - in vba editor go to tools>references and find Microsoft Excel xx.0 Object Library. Replace xx with whatever version you have, 14, 16 whatever. This is what is called early binding.

    However, further down the code provided is a line

    Set xl = CreateObject("Excel.Application")

    This is normally used for late binding, in which case replace

    Dim xl As Excel.Application
    Dim wb As Excel.Workbook


    with

    Dim xl As Object
    Dim wb As Object


    Google 'late binding v early binding' to find out what the differences are. But essentially, early binding provides typeaheads for data types but reduces application portability to other users whilst late binding improves portability. Most developers will develop using early binding and then convert to late binding when the application is ready to be distributed.

    However not sure this will solve your formatting problem, or perhaps the thread has moved on. As mentioned in my early post, in your query, you would need to use to use the format/round/etc functions to create text formatted as you require
    Last edited by orange; 01-21-2018 at 06:15 PM. Reason: adjusted quote tag

  4. #19
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Thanks June, Orange & Ajax,

    Code worked like a charm once the references were set. Thanks June.

    Orange, I get your point and would try my level best to adhere to it. For now I am able to get the desired format to perfection, thanks for your help and insight.

    Ajax, Thanks for your help and knowledge. For your knowledge sake I did copy and paste, it was just when I replied, miss typed it. Now i read about early & late binding, with my limited understanding I think I will stick with early binding for now. Still many a thanks for pointing it out for future use. Thanks.

    Looking forward to your continued support & guidance.
    Thanks and Regards
    Deepak Gupta

  5. #20
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,816
    Advantage with early binding is the intellisense popup tips. Can always change code to late binding after confident it runs properly.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  6. #21
    deepakg27 is offline Competent Performer
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2017
    Posts
    160
    Thanks June.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 11-23-2017, 03:22 PM
  2. Replies: 5
    Last Post: 09-02-2017, 01:43 PM
  3. Replies: 4
    Last Post: 05-07-2015, 04:02 PM
  4. exporting query to text comma separated
    By Pasi in forum Queries
    Replies: 6
    Last Post: 12-27-2013, 06:42 PM
  5. Replies: 6
    Last Post: 06-26-2011, 12:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums