<?xml version="1.0" encoding="iso-8859-1" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Dansk Regneark Forum : Sende en del af en WB som mail</title>
  <link>https://forum.excel-regneark.dk/</link>
  <description><![CDATA[Dette er et XML Feed af; Dansk Regneark Forum : Makro og VBA : Sende en del af en WB som mail]]></description>
  <pubDate>Sat, 05 Dec 2026 12:37:00 +0000</pubDate>
  <lastBuildDate>Tue, 30 Oct 2012 18:41:44 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.08</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>https://forum.excel-regneark.dk/RSS_post_feed.asp?TID=951</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Dansk Regneark Forum]]></title>
   <url>https://forum.excel-regneark.dk/css_styles/Excel-regneark.dk/logo.png</url>
   <link>https://forum.excel-regneark.dk/</link>
  </image>
  <item>
   <title><![CDATA[Sende en del af en WB som mail : Godaften :)  Jeg har i l&#230;ngere...]]></title>
   <link>https://forum.excel-regneark.dk/sende-en-del-af-en-wb-som-mail_topic951_post4529.html#4529</link>
   <description>
    <![CDATA[<strong>Forfatter:</strong> <a href="https://forum.excel-regneark.dk/member_profile.asp?PF=685">hejbeiter</a><br /><strong>Emne:</strong> 951<br /><strong>Sendt:</strong> 30.Okt.2012 kl. 18:41<br /><br /><DIV>Godaften :)</DIV><DIV>&nbsp;</DIV><DIV>Jeg har i længere tid rodet med Microsoft Excel VBA, men er kommet lidt til kort med min seneste opgave.<BR><BR>Kort fortalt skal jeg i en stor excel workbook kopiere et afgrænset område ind i en ny workbook, som skal sendes til en liste af kontaktpersoner via Microsoft Outlook. Jeg har skrevet alt koden til at udfører opgaven, men den giver mig et bug med hensyn til flettede celler.<BR><BR><BR><strong>Koden er som følger:<BR></strong><BR>Sub Mail_Range()<BR>' Works in Excel 2000, Excel 2002, Excel 2003, Excel 2007, Excel 2010, Outlook 2000, Outlook 2002, Outlook 2003, Outlook 2007, Outlook 2010.<BR>Dim Source As Range<BR>Dim Dest As Workbook<BR>Dim wb As Workbook<BR>Dim TempFilePath As String<BR>Dim TempFileName As String<BR>Dim FileExtStr As String<BR>Dim FileFormatNum As Long<BR>Dim OutApp As Object<BR>Dim OutMail As Object<BR><BR>Set Source = Nothing<BR>On Error Resume Next<BR>Set Source = Range("A1:K50").SpecialCells(xlCellTypeVisib-<BR>le)<BR>On Error GoTo 0<BR><BR>If Source Is Nothing Then<BR>MsgBox "The source is not a range or the sheet is protected. " &amp; _<BR>"Please correct and try again.", vbOKOnly<BR>Exit Sub<BR>End If<BR><BR>With Application<BR>.ScreenUpdating = False<BR>.EnableEvents = False<BR>End With<BR><BR>Set wb = ActiveWorkbook<BR>Set Dest = Workbooks.Add(xlWBATWorksheet)<BR>Source.Copy<BR>With Dest.Sheets(1)<BR>.Cells(1).PasteSpecial Paste:=8<BR>.Cells(1).PasteSpecial Paste:=xlPasteValues<BR>.Cells(1).PasteSpecial Paste:=xlPasteFormats<BR>.Cells(1).Select<BR>Application.C-<BR>utCopyMode = False<BR>End With<BR><BR>TempFilePath = Environ$("temp") &amp; "\"<BR>TempFileName = "Selection of " &amp; wb.Name &amp; " " _<BR>&amp; Format(Now, "dd-mmm-yy h-mm-ss")<BR><BR>If Val(Application.Version) &lt; 12 Then<BR>' You are using Excel 2000 or 2003.<BR>FileExtStr = ".xls": FileFormatNum = -4143<BR>Else<BR>' You are using Excel 2007 or 2010.<BR>FileExtStr = ".xlsx": FileFormatNum = 51<BR>End If<BR><BR>Set OutApp = CreateObject("Outlook.Application")<BR>Set OutMail = OutApp.CreateItem(0)<BR><BR>With Dest<BR>.SaveAs TempFilePath &amp; TempFileName &amp; FileExtStr, _<BR>FileFormat:=FileFormatNum<BR>On Error Resume Next<BR>With OutMail<BR>.To = ""<BR>.CC = ""<BR>.BCC = ""<BR>.Subject = ""<BR>.Body = ""<BR>.Attachments.Add Dest.FullName<BR>' You can add other files by uncommenting the following statement.<BR>'.Attachments.Add ("C:\test.txt")<BR>' In place of the following statement, you can use ".Display" to<BR>' display the e-mail message.<BR>.Send <BR>End With<BR>On Error GoTo 0<BR>.Close SaveChanges:=False<BR>End With<BR><BR>Kill TempFilePath &amp; TempFileName &amp; FileExtStr<BR><BR>Set OutMail = Nothing<BR>Set OutApp = Nothing<BR><BR>With Application<BR>.ScreenUpdating = True<BR>.EnableEvents = True<BR>End With<BR><BR>End Sub<BR><BR><strong>Fejlen jeg får er:<BR></strong><BR><BR>Run-time Error '1004'<BR><BR>Parts of the merged cells cannot be changed<BR><BR><strong>Når jeg debugger markere den området:<BR><BR></strong>Source.Copy<BR>With Dest.Sheets(1)<BR>.Cells(1).PasteSpecial Paste:=8<BR>.Cells(1).PasteSpecial Paste:=xlPasteValues<BR>.Cells(1).PasteSpecial Paste:=xlPasteFormats<BR>.Cells(1).Select<BR><BR><BR>Nogen der kan hjælpe? :)<BR><BR></DIV>]]>
   </description>
   <pubDate>Tue, 30 Oct 2012 18:41:44 +0000</pubDate>
   <guid isPermaLink="true">https://forum.excel-regneark.dk/sende-en-del-af-en-wb-som-mail_topic951_post4529.html#4529</guid>
  </item> 
 </channel>
</rss>