Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. excel

excel

Scheduled Pinned Locked Moved C#
questioncsharp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    arkiboys
    wrote on last edited by
    #1

    Hi, The c# code is populating a workbook template with the latest data which is run by the c# code... in the c# code there is workbook.RefreshAll(); At this stage, I expect to see the latest data inside the spreadsheet BUT the template shows the old data which was in the template before. To see the latest data, I have to go to the spreadsheet which was populated but I have to click on data, refresh data to see the latest figures. How can I solve this please? Thanks

    A 1 Reply Last reply
    0
    • A arkiboys

      Hi, The c# code is populating a workbook template with the latest data which is run by the c# code... in the c# code there is workbook.RefreshAll(); At this stage, I expect to see the latest data inside the spreadsheet BUT the template shows the old data which was in the template before. To see the latest data, I have to go to the spreadsheet which was populated but I have to click on data, refresh data to see the latest figures. How can I solve this please? Thanks

      A Offline
      A Offline
      Alan N
      wrote on last edited by
      #2

      A useful tip for solving a problem such as this is to look at the code generated by the MS Office macro recorder. In your case go the spreadsheet, turn on the recorder, and perform the actions required to refresh the data. Examine the macro's BASIC source code to find out how it was done. It usually fairly simple to write the C# version but if you have any problems post the macro code here. Alan.

      A 1 Reply Last reply
      0
      • A Alan N

        A useful tip for solving a problem such as this is to look at the code generated by the MS Office macro recorder. In your case go the spreadsheet, turn on the recorder, and perform the actions required to refresh the data. Examine the macro's BASIC source code to find out how it was done. It usually fairly simple to write the C# version but if you have any problems post the macro code here. Alan.

        A Offline
        A Offline
        arkiboys
        wrote on last edited by
        #3

        Hi, Macro is not being used. It is c# as mentioned before. Thanks

        I A 2 Replies Last reply
        0
        • A arkiboys

          Hi, Macro is not being used. It is c# as mentioned before. Thanks

          I Offline
          I Offline
          Ian Shlasko
          wrote on last edited by
          #4

          Alan's right... Even if you're not using macros for your actual project, try recording a macro that does what you need. Excel will automatically generate the code in VBA, and you can use that as a guide to figure out how to do it in C#.

          Proud to have finally moved to the A-Ark. Which one are you in?
          Author of the Guardians Saga (Sci-Fi/Fantasy novels)

          1 Reply Last reply
          0
          • A arkiboys

            Hi, Macro is not being used. It is c# as mentioned before. Thanks

            A Offline
            A Offline
            Alan N
            wrote on last edited by
            #5

            Yes I understand that you are not writing a macro but in many cases macro code and office interop code are very similar. This means that the macro code for the update operation will show you which methods and properties you should use in your C# code. Alan.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups