sub MyGlavniyMacros()
select case ActiveSheet.range("A1").value
case 1: call MySlaveMacros1()
case 2: call MySlaveMacros2()
case else : call MySlaveMacrosDefault()
end select
end sub
Sub test()
Dim rng As Range
Dim v, vr, vc As Variant
Dim i&, j As Long
Dim sRes As String
Set rng = Selection
v = rng
ReDim vc(LBound(v) To UBound(v))
For i = LBound(v) To UBound(v)
ReDim vr(LBound(v, 2) To UBound(v, 2))
For j = LBound(v, 2) To UBound(v, 2)
vr(j) = v(i, j)
Next j
vc(i) = Join(vr, ",")
Next i
sRes = Join(vc, ";")
Set rng = Application.InputBox("Выберите ячейку", "Object", Type:=8)
rng = sRes
End Sub
/**
* By Pytex
* Добавляет картинку в медиабиблиотеку и
* прикрепляет ее к посту как миниатюру
*
* @param array $img
* @param number $post_id
*/
private function atach_image( $img, $post_id ) {
$file_array = array();
$file_array['name'] = $img['name'] ;
$file_array['tmp_name'] = $img['path'];
// upload file to library
$media_id = media_handle_sideload( $file_array, $post_id);
if( !is_wp_error($media_id) ) {
// attach image to post
set_post_thumbnail($post_id, $media_id);
}
return $media_id;
}
wp_delete_attachment( $attach_id, true );
$line = get_term_children( (int) $cat_parent, 'product_cat');