+ Reply to Thread
Results 1 to 10 of 10

Problems with a section of VBA

  1. #1
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Problems with a section of VBA

    Hi Fellow Forum Members
    I am having an issue with a portion of my VBA code. Here is the code:
    Please Login or Register  to view this content.
    res is a variable which contains the name of the resource assigned to a selection of tasks in a MS Ptroject Plan.
    Basically what is happening is that I have a template which contains VBA code. When I paste data into the template it is formated by code prior to this section of the code and it works fine. However this portion of the code leaves a copy of the template open as a read only version of the template. So I end up with approximately 20 copies of the template open as read-only. I am using Excel 2010.
    Any help would be appreciated.
    Kind regards
    Tony

  2. #2
    Forum Expert Bob Phillips's Avatar
    Join Date
    09-03-2005
    Location
    Wessex
    MS-Off Ver
    Office 2003, 2010, 2013, 2016, 365
    Posts
    3,284

    Re: Problems with a section of VBA

    Could you try closing it after saving it?

  3. #3
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Problems with a section of VBA

    I tried the code in al little test macro..

    Please Login or Register  to view this content.
    The file name res should contain path and file extention
    Extention must be .xls due to FileFormat:=56

    Works fine with me.
    After executing the macro, Excel closes.
    Maybe problem is in the res string..

    gr.
    Gerard

  4. #4
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Problems with a section of VBA

    Hi Gerard
    Here is a copy of my code for clarity. It is failing on the highlighted part:
    Please Login or Register  to view this content.
    Tony
    Last edited by ARGK; 12-29-2013 at 05:29 PM.

  5. #5
    Forum Contributor
    Join Date
    01-03-2013
    Location
    Aberdeen, Scotland
    MS-Off Ver
    Excel 2007
    Posts
    163

    Re: Problems with a section of VBA

    I noticed, there is a colon missing in res path (I think it should be D:\TR Programme\), although I have completely no idea, if this solves the problem

  6. #6
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Problems with a section of VBA

    Hi Sbarro79
    Well spotted .
    However this does not resolve my issue .
    Thanks
    Tony

  7. #7
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Problems with a section of VBA

    Have you tested
    Please Login or Register  to view this content.
    as Bob Phillips has suggested?
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  8. #8
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Problems with a section of VBA

    Maybe it is better to use .Text is stead of .Value

    Please Login or Register  to view this content.
    I cant see what is copied into the sheet, but understand that there is a file name pasted in Range("A2").

    Also

    Please Login or Register  to view this content.
    res is empty so code will goto Finish
    Can't see what finish does.

    Maybe debug the macro by steppin trough using [F8] function key may give you insite where the code goes and variables contain.

    gr.
    Gerard

  9. #9
    Valued Forum Contributor
    Join Date
    10-26-2008
    Location
    Birmingham, UK
    MS-Off Ver
    All versions up to 2010
    Posts
    1,025

    Re: Problems with a section of VBA

    Hi Guys
    No idea what is different but his code appears to work fine:
    Please Login or Register  to view this content.
    Thanks for your help guys.
    Tony

  10. #10
    Forum Contributor
    Join Date
    12-14-2013
    Location
    Tilburg, Nederland
    MS-Off Ver
    Excel 2010
    Posts
    256

    Re: Problems with a section of VBA

    It's on several point different to the code posted initial.....

+ 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. Replies: 1
    Last Post: 06-16-2013, 07:36 AM
  2. Deleting Row Section without Disrupting Formula Range Outside of Deleted Section
    By JeffNYG23 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-14-2013, 09:10 AM
  3. Moving section headings from below section to above section..
    By Fayebaline in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-24-2011, 06:58 AM
  4. Section Break
    By frutz in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 07-01-2009, 05:08 AM
  5. move that Row From the Waiting section to the completed section automaticly
    By jjsaw5 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-21-2007, 06:50 PM

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