Check alle échte Black Friday-deals Ook zo moe van nepaanbiedingen? Wij laten alleen échte deals zien
Toon posts:

Probleem met de publishanalysis macro

Pagina: 1
Acties:
  • 382 views

Verwijderd

Topicstarter
Beste mensen,

Graag verzoek ik om jullie help bij de volgende macro:

het gaat om de onderstreepte en zwartgedrukte regel. VBA blijft zeggen dat er een fout in die regel van de macro zit, maar ik zelf kom er niet uit; wat dit precies is. kunnen jullie mij misschien helpen?

Sub PublishAnalysis()

'Use this macro to publish a Profit analysis as a cockpit.
'This macro will save an Excel worksheet to htm.
'In earlier versions the Excel worksheet was saved to pdf (old help files will still have descriptions of this).
'You also need the 'GenerateXMLForInsite' function.

Dim strFilePath As String
Dim strFileName As String
Dim strSheetName As String
Dim strPublishArea As String
Dim strHeightInPixels As String
Dim strWidthInPixels As String
Dim strActualHeight As String
Dim strActualWidth As String

'Publication folder and htm name
'THE FOLDER NAME MUST END WITH A BACKSLASH\
strFilePath = "\\filer2\cockpits\O51753AA\test1\"
strFileName = "test1.htm"

'Name of the Excel sheet you want to publish and the cell range on this sheet
strSheetName = "ExcelSheetToBePublished"
strPublishArea = "$A$1:$E$60"

strActualHeight = Worksheets("Cockpit Verkort Alles").Range("$A$1:$E$60").Height
strHeightInPixels = CStr(Round(strActualHeight * 1.322834646) + 1) + "px"
strActualWidth = Worksheets("Cockpit Verkort Alles").Range("$A$1:$E$60").Width
strWidthInPixels = CStr(Round(strActualWidth * 1.322834646) + 1) + "px"

ActiveWorkbook.PublishObjects.Add(xlSourceRange, "\\filer2\cockpits\O51753AA\test1\" & "test1.htm", "Cockpit Verkort Alles", "$A$1:$E$60", xlHtmlStatic, "Cockpit Verkort Alles").Publish (True)

'Generate xml file for publication in Profit InSite
GenerateXMLForInsite strHeightInPixels, strWidthInPixels, strFilePath, strFileName
End Sub
Function GenerateXMLForInsite(ByVal parHeightInPixels As String, ByVal parWidthInPixels As String, ByVal parFilePath As String, ByVal parFileName As String)
'Functie die een xml-bestand genereert om de analyse te kunnen publiceren in insite

'Variables
Dim objDom As New DOMDocument
Dim objCockpitElement As IXMLDOMElement
Dim objAttribute As IXMLDOMAttribute

objDom.appendChild objDom.createProcessingInstruction("xml", "version =""1.0"" encoding=""utf-8""")

Set objCockpitElement = objDom.appendChild(objDom.createElement("cockpit"))
Set objAttribute = objDom.createAttribute("startLocation")
objAttribute.Value = parFileName
objCockpitElement.Attributes.setNamedItem objAttribute

Set objAttribute = objDom.createAttribute("height")
objAttribute.Value = parHeightInPixels
objCockpitElement.Attributes.setNamedItem objAttribute

Set objAttribute = objDom.createAttribute("width")
objAttribute.Value = parWidthInPixels
objCockpitElement.Attributes.setNamedItem objAttribute

objDom.Save parFilePath & "insite.xml"
End Function

Alvast bedankt!

Robin

[ Voor 7% gewijzigd door Verwijderd op 23-09-2014 16:12 ]


  • Creepy
  • Registratie: Juni 2001
  • Laatst online: 23:25

Creepy

Tactical Espionage Splatterer

We gaan er hier vanuit dat je in eerste instantie zelf probeert je foutmelding op te lossen. Zomaar je code dumpen en verder zonder enig vooronderzoek zomaar om hulp vragen is nu net niet de bedoeling hier.

Ik gok ook dat VBA niet zegt dat er een fout zit, maar dat ie precies aangeeft om welke fout het gaat. Heb je die foutmelding al eens in google gegooid? Ik denk dat er wel wat bruikbaars tussen de zoekresultaten zal zitten. Zo niet, dan kan je alsnog weer een topic openen maar geef dan aub wel aan wat de fout precies is en wat je zelf al hebt geprobeerd om je fout op te lossen.

Overigens staat in Devschuur® Beleid mooi uitgelegd wat hier nu wel en niet kan, en welke informatie we graag terug willen zien in een topicstart

[ Voor 12% gewijzigd door Creepy op 23-09-2014 21:04 ]

"I had a problem, I solved it with regular expressions. Now I have two problems". That's shows a lack of appreciation for regular expressions: "I know have _star_ problems" --Kevlin Henney


  • RobIII
  • Registratie: December 2001
  • Niet online

RobIII

Admin Devschuur®

^ Romeinse Ⅲ ja!

(overleden)
^ Kleine aanvulling daarop: als je code post, gebruik dan code tags voortaan a.u.b. ;)

There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery.

Je eigen tweaker.me redirect

Over mij


Dit topic is gesloten.