Hi, I am still self learning VBA code on Windows but i now need it to work on a mac! I have some code that basically copies a set area from excel and pastes it into word as a picture (it does it as many times as there are columns in another tab)
I have it working perfectly on Windows but can not get it to work for mac? I have managed to get it to at least open a word file on the mac now but all it does is paste blank pictures and not the actual selection from excel... My main issue is that i dont actually have a mac so i can not test that it is working, i have to keep sending it back and asking if it worked Please help!
Windows Code:
This is what i have so far for the mac:
I have it working perfectly on Windows but can not get it to work for mac? I have managed to get it to at least open a word file on the mac now but all it does is paste blank pictures and not the actual selection from excel... My main issue is that i dont actually have a mac so i can not test that it is working, i have to keep sending it back and asking if it worked Please help!
Windows Code:
VBA Code:
''''Create Word
Dim objWord, objDoc As Object
Set objWord = CreateObject("Word.Application")
Set objDoc = objWord.Documents.Add
With objDoc.PageSetup
.Orientation = wdOrientLandscape
End With
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Start Task
'SetUp
Dim cab As Long
Dim dab As Long
Sheet21.Select
cab = Cells(1, Columns.Count).End(xlToLeft).Column
For dab = 1 To cab
'Action
Sheet21.Select
ActiveSheet.Range(Cells(1, dab), Cells(20, dab)).Select
Selection.Copy
Sheet2.Select
Sheet2.Range("L10").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
'Copy To Word
Sheet2.Select
On Error Resume Next
Range("Print_Area50").CopyPicture Appearance:=xlScreen, Format:=xlPicture
objWord.Visible = True
objWord.Selection.Paste
objWord.Selection.TypeParagraph
'Next Task
Next dab
This is what i have so far for the mac:
VBA Code:
''''Create Word
Dim oWord As Object
Set oWord = CreateObject(Class:=("Word.application"))
oWord.Visible = True
oWord.Activate
Dim oDoc
Set oDoc = oWord.Documents.Add
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''Start Task
'SetUp
Dim cab As Long
Dim dab As Long
Sheet21.Select
cab = Cells(1, Columns.Count).End(xlToLeft).Column
For dab = 1 To cab
Sheet21.Select
ActiveSheet.Range(Cells(1, dab), Cells(20, dab)).Select
Selection.Copy
Sheet2.Select
Sheet2.Range("L10").Select
Selection.PasteSpecial Paste:=xlPasteAll, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
'Copy To Word
Sheet21.Select
On Error Resume Next
Range("Print_Area50").CopyPicture
oWord.Aapplication
oWord.Application.Selection.PasteSpecial Link:=False, DataType:=15, _
DisplayAsIcon:=False
oWord.Selection.TypeParagraph
'Next Task
Next dab