<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Mutiple Excel-Vb Questions in VBA Forum</title>
    <link>https://forums.autodesk.com/t5/vba-forum/mutiple-excel-vb-questions/m-p/2250235#M19862</link>
    <description>There should be numerous examples of connecting to Excel in this group. Try&lt;BR /&gt;
searching for "excel", "GetObject" or "CreateObject". I believe there is&lt;BR /&gt;
also a special group for connectivity.&lt;BR /&gt;
&lt;BR /&gt;
According to Excel help, you can not use the "Undo" method to reverse any&lt;BR /&gt;
changes made through code.&lt;BR /&gt;
&lt;BR /&gt;
I think your only option to revert to the "last saved" state (without a&lt;BR /&gt;
workaround)  will be to close and reopen the file.&lt;BR /&gt;
&lt;BR /&gt;
Here is a sample workaround (hack) that will create a hidden "undo"&lt;BR /&gt;
worksheet. It will copy everything from the first worksheet to the hidden&lt;BR /&gt;
worksheet. You could run it in reverse to simulate an undo. I did not try&lt;BR /&gt;
using "xlSheetVeryHidden". The docs say that would prevent users from ever&lt;BR /&gt;
unhiding the sheet.&lt;BR /&gt;
&lt;BR /&gt;
Dim oUndoSheet As Worksheet&lt;BR /&gt;
Dim oDataSheet As Worksheet&lt;BR /&gt;
&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
&lt;BR /&gt;
Set oUndoSheet = ThisWorkbook.Worksheets("UndoData")&lt;BR /&gt;
&lt;BR /&gt;
If Err Then&lt;BR /&gt;
    Err.Clear&lt;BR /&gt;
    Set oUndoSheet =&lt;BR /&gt;
ThisWorkbook.Worksheets.Add(after:=Worksheets(Worksheets.Count))&lt;BR /&gt;
    oUndoSheet.Name = "UndoData"&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
On Error GoTo 0&lt;BR /&gt;
&lt;BR /&gt;
oUndoSheet.Visible = xlSheetHidden&lt;BR /&gt;
oUndoSheet.UsedRange.Clear&lt;BR /&gt;
&lt;BR /&gt;
Set oDataSheet = ThisWorkbook.Worksheets(1)&lt;BR /&gt;
&lt;BR /&gt;
oDataSheet.UsedRange.Copy&lt;BR /&gt;
oUndoSheet.Paste Destination:=oUndoSheet.Cells(1, 1)&lt;BR /&gt;
&lt;BR /&gt;
oDataSheet.Activate</description>
    <pubDate>Thu, 08 May 2008 12:39:55 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2008-05-08T12:39:55Z</dc:date>
    <item>
      <title>Mutiple Excel-Vb Questions</title>
      <link>https://forums.autodesk.com/t5/vba-forum/mutiple-excel-vb-questions/m-p/2250234#M19861</link>
      <description>I'm somewhat new to this and really strugglying linking to excel.  I simply need my application to link itself to an existing excel file by its filepath upon opening(application), so that I can then use data from the application and put it into the spreadsheet.  Also is there a command to reset an excel spreadsheet to its saved self so that it can be used as somewhat of an erase command?  Is there anywhere I can get examples of this kind of coding so that i can try and apply it to what i'm doing?</description>
      <pubDate>Thu, 08 May 2008 00:40:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/mutiple-excel-vb-questions/m-p/2250234#M19861</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-05-08T00:40:54Z</dc:date>
    </item>
    <item>
      <title>Re: Mutiple Excel-Vb Questions</title>
      <link>https://forums.autodesk.com/t5/vba-forum/mutiple-excel-vb-questions/m-p/2250235#M19862</link>
      <description>There should be numerous examples of connecting to Excel in this group. Try&lt;BR /&gt;
searching for "excel", "GetObject" or "CreateObject". I believe there is&lt;BR /&gt;
also a special group for connectivity.&lt;BR /&gt;
&lt;BR /&gt;
According to Excel help, you can not use the "Undo" method to reverse any&lt;BR /&gt;
changes made through code.&lt;BR /&gt;
&lt;BR /&gt;
I think your only option to revert to the "last saved" state (without a&lt;BR /&gt;
workaround)  will be to close and reopen the file.&lt;BR /&gt;
&lt;BR /&gt;
Here is a sample workaround (hack) that will create a hidden "undo"&lt;BR /&gt;
worksheet. It will copy everything from the first worksheet to the hidden&lt;BR /&gt;
worksheet. You could run it in reverse to simulate an undo. I did not try&lt;BR /&gt;
using "xlSheetVeryHidden". The docs say that would prevent users from ever&lt;BR /&gt;
unhiding the sheet.&lt;BR /&gt;
&lt;BR /&gt;
Dim oUndoSheet As Worksheet&lt;BR /&gt;
Dim oDataSheet As Worksheet&lt;BR /&gt;
&lt;BR /&gt;
On Error Resume Next&lt;BR /&gt;
&lt;BR /&gt;
Set oUndoSheet = ThisWorkbook.Worksheets("UndoData")&lt;BR /&gt;
&lt;BR /&gt;
If Err Then&lt;BR /&gt;
    Err.Clear&lt;BR /&gt;
    Set oUndoSheet =&lt;BR /&gt;
ThisWorkbook.Worksheets.Add(after:=Worksheets(Worksheets.Count))&lt;BR /&gt;
    oUndoSheet.Name = "UndoData"&lt;BR /&gt;
End If&lt;BR /&gt;
&lt;BR /&gt;
On Error GoTo 0&lt;BR /&gt;
&lt;BR /&gt;
oUndoSheet.Visible = xlSheetHidden&lt;BR /&gt;
oUndoSheet.UsedRange.Clear&lt;BR /&gt;
&lt;BR /&gt;
Set oDataSheet = ThisWorkbook.Worksheets(1)&lt;BR /&gt;
&lt;BR /&gt;
oDataSheet.UsedRange.Copy&lt;BR /&gt;
oUndoSheet.Paste Destination:=oUndoSheet.Cells(1, 1)&lt;BR /&gt;
&lt;BR /&gt;
oDataSheet.Activate</description>
      <pubDate>Thu, 08 May 2008 12:39:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/vba-forum/mutiple-excel-vb-questions/m-p/2250235#M19862</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2008-05-08T12:39:55Z</dc:date>
    </item>
  </channel>
</rss>

